passing argument to start-process that contains commas ???
Posted: Sun Sep 27, 2015 8:22 pm
Hi,
Hope I can post this type of question here...
I am trying to run a command using start-process with an argument that has commas or question marks in it but am unable to work out how.
This is my code:
now the first start-process works fine but the second one doesn't work, the cmd box gives an error: Invalid parameter "domain\username:(X," and the third also fails giving back the help for 'net share'
as you can see the full list of right are cut of after the first comma.
can anyone provide some help with this
Regards
Rodney
Hope I can post this type of question here...
I am trying to run a command using start-process with an argument that has commas or question marks in it but am unable to work out how.
This is my code:
Code: Select all
$cmd = $env:comspec
$arg = "/k TakeOwn.exe /F " + """" + $folder + """" + " /A /R /D Y /SKIPSL"
Start-Process $cmd -Args $arg -WindowStyle 'Normal' -Wait
$arg = "/k icacls " + $folder + " /grant DOMAIN\" + $folderName + ":(X, RD, RA, WD, AD, GR)"
Start-Process $cmd -Args $arg -WindowStyle 'Normal' -Wait
$arg = "/k net share " + $folderName + "$=" + $folder + " /grant:EVERYONE, FULL"
Start-Process $cmd -Args $arg -WindowStyle 'Normal' -Wait
as you can see the full list of right are cut of after the first comma.
can anyone provide some help with this
Regards
Rodney