Executing a Powershell script in CMD.EXE from a location with "Illegal characters in path" -
i attempting call powershell script in cmd.exe , script in location looks this: c:data\foo - bar\location-1\shellscript.ps1
when calling script have tried using single , double quotes around path no luck.
powershell.exe -file "c:\data\foo - bar\location-1\shellscript.ps1" arg1 arg2
from have read assumed above work did not work nor did single quotes.
i appreciate ideas.
thanks *edit * mistype on example path. sorry.
one solution move powershell v3 works fine:
ps> powershell.exe -file 'c:\temp\foo - bar\location-1\foo.ps1' arg1 arg2 made it!, args arg1, arg2
if need stay on v2 try escaping spaces e.g.:
ps> powershell.exe -file "c:\temp\foo` -` bar\location-1\foo.ps1" arg1 arg2
from cmd.exe, should work:
c:\> powershell.exe -command "& {& 'c:\data\foo - bar\location-1\shellscript.ps1' arg1 arg2}"
Comments
Post a Comment