View Single Post
Old 05-02-2007   #3 (permalink)
Marcel J. Ortiz [MSFT]


 
 

Re: Executing Power Shell Scripts from Windows Shell

> My question is, even when the path is enclosed within double quotes,
> why does powershell not recogonize the entire path and one single
> argument?


Its because powershell doesn't get the double quotes. cmd.exe will strip
the double quotes. Try something like this:

powershell "& 'd:\foo bar\script.ps1' "

cmd will strip the double quotes and powershell will run:
& 'd:\foo bar\script.ps1'



"Mugunth" <mugunth.kumar@gmail.com> wrote in message
news:1178098304.162166.326700@l77g2000hsb.googlegroups.com...
> Typing
> powershell "D:\PowerShell Examples\TempScript.ps1"
> on the cmd prompt, gives an error that,
> The term 'D:\PowerShell' is not recognized as a cmdlet, function,
> operable program, or script file. Verify the term and try again.
> I understood that, it was because of the space.
> So I removed the space and tried again and the script executed
> successfully.
>
> However,
> typing
> type "D:\PowerShell Examples\TempScript.ps1"
> on the cmd prompt works fine.
>
> My question is, even when the path is enclosed within double quotes,
> why does powershell not recogonize the entire path and one single
> argument?
>
> Any help would be appreciated.
>


My System SpecsSystem Spec