[Scilab-users] issue providing command to powershell

David Chèze david.cheze at cea.fr
Wed Feb 3 14:21:26 CET 2016


Hi all,

to automate some text file encoding conversion to UTF-8 (for csvRead) under
windows platform, I'm using the powershell windows native scripting language
:

PS get-content -Path "C:\Users\dc227480\Documents\temp\Données IAQ SENSE
29_01_2016 10_45_00 1.dat.csv" | out-file
"C:\Users\dc227480\Documents\temp\Données IAQ SENSE 29_01_2016 10_45_00
1.UTF-8.csv" -encoding utf8
 
that is running properly  in powershell window but fails when I ask from
scilab:
pscmd="get-content -Path ""C:\Users\dc227480\Documents\temp\Données IAQ
SENSE 29_01_2016 10_45_00 1.dat.csv"" | out-file
""C:\Users\dc227480\Documents\temp\Données IAQ SENSE 29_01_2016 10_45_00
1.UTF-8.csv"" -encoding utf8"
powershell(pscmd)
 ans  =

!Get-Content : Impossible de trouver un paramètre positionnel acceptant          
!
!                                                                                
!
!l'argument «IAQ».                                                               
!
!                                                                                
!
!Au caractère Ligne:1 : 1                                                        
!
!                                                                                
!
!+ get-content -Path C:\Users\dc227480\Documents\temp\Données IAQ SENSE          
!
!                                                                                
!
!29_01_2016  ...                                                                 
!
!                                                                                
!
!+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
!
!                                                                                
!
!~~~                                                                             
!
!                                                                                
!
!    + CategoryInfo          : InvalidArgument : (:) [Get-Content],
ParameterBi   !
!                                                                                
!
!   ndingException                                                               
!
!                                                                                
!
!    + FullyQualifiedErrorId :
PositionalParameterNotFound,Microsoft.PowerShell   !
!                                                                                
!
!   .Commands.GetContentCommand                                                  
!
!                                                                                
!
!                                                                                
!
Then I remove space from the file name and it works:
pscmd="get-content -Path
""C:\Users\dc227480\Documents\temp\Données_IAQ_SENSE_29_01_2016_10_45_00_1.dat.csv""
| out-file
""C:\Users\dc227480\Documents\temp\Données_IAQ_SENSE_29_01_2016_10_45_00_1.UTF-8.csv""
-encoding utf8"
powershell(pscmd)

Is there a workaround to make the powershell() function from scilab to
provide proper string to powershell ?

Thank you for your feedback,
David




--
View this message in context: http://mailinglists.scilab.org/issue-providing-command-to-powershell-tp4033376.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the users mailing list