![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Executing Power Shell Scripts from Windows Shell 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 Specs![]() |
| | #2 (permalink) |
| | RE: Executing Power Shell Scripts from Windows Shell Another couple of alternatives to running scripts with spaces in the path c:\scripts\"test two"\test.ps1 will work. As will $a = "c:\scripts\test two\test.ps1" &$a When the whole path is in quotes powershell will recognise it as a string. So you either put part of the path in quotes or execute the command within the string -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty Blog: http://richardsiddaway.spaces.live.com/ PowerShell User Group: http://www.get-psuguk.org.uk "Mugunth" wrote: > 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 Specs![]() |
| | #3 (permalink) |
| | 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 Specs![]() |
| | #4 (permalink) |
| | Re: Executing Power Shell Scripts from Windows Shell On May 2, 8:48 pm, "Marcel J. Ortiz [MSFT]" <mos...@online.microsoft.com> wrote: > > 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.ku...@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. Thanks, This is what I really needed... |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Can parent shell monitor run/crash status of Child shell/exe ? | PowerShell | |||
| Executing secondary command in shell.run | VB Script | |||
| How to enable Power shell scripts | PowerShell | |||
| Windows Command (Power Shell) does not work in Vista v5728 | Vista General | |||