Author Posts

December 31, 2015 at 4:49 am

Hello
i need to start a program from a ps script that contains the hashsign (#) insilde the program parameters.
can someone help me find the way to do this ?

$command = 'c:\somecommand.exe -msg:text1 -number:#456852,4578684'
$command
$result= invoke-expression $command

i believe that powershell see the # as comment and not reading anything after it

Thanks

December 31, 2015 at 6:08 am

Use the backtick ` should produce what you see below:

$command = 'echo test -number:`#12345678,45682'
Invoke-Expression -Command $command

test
-number:
#12345678
45682