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