![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | running script with blank space in path Hi, I'm trying tu run script from outside of PowerShell. The file is in a folder with blank space. I tried many things - using " or ' or ampersand in the beginning - but either way I get an error (powershell.exe "c:\my scripts\test.ps1" The term 'c:\my' is not recognized as a cmdlet, function, operable program, or script file. Verify the term and try again. At line:1 char:6 + c:\my <<<< scripts\test.ps1) or when I use ampersand (powershell.exe -noexit &'c:\my scripts\test.ps1') I enter PowerShell Console and the script is not executed. I found this info on ampersand on: http://www.microsoft.com/technet/scr...anual/run.mspx but it doesn't seem to be working. Any ideas? Tomek |
My System Specs![]() |
| | #2 (permalink) |
| | Re: running script with blank space in path tomek wrote: Quote: > Hi, > > I'm trying tu run script from outside of PowerShell. The file is in a > folder with blank space. > I tried many things - using " or ' or ampersand in the beginning - but > either way I get an error > > (powershell.exe "c:\my scripts\test.ps1" > The term 'c:\my' is not recognized as a cmdlet, function, operable > program, or > script file. Verify the term and try again. > At line:1 char:6 > + c:\my <<<< scripts\test.ps1) > > or when I use ampersand > (powershell.exe -noexit &'c:\my scripts\test.ps1') > I enter PowerShell Console and the script is not executed. > > I found this info on ampersand on: > http://www.microsoft.com/technet/scr...anual/run.mspx > but it doesn't seem to be working. Any ideas? > Tomek powershell.exe -command "&{& 'C:\some space\test.ps1'} Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
My System Specs![]() |
| | #3 (permalink) |
| | Fix As the example that follows shows you will have to use a back-tick to escape the space in your file path. powershell.exe -noexit (&"d:\labs\new` folder\fixeddrivedata.ps1") |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Fix You can try this too: powershell.exe -noexit (& "'D:\Scripts\temp\New Folder\noexit.ps1'") -or- powershell.exe -noexit "& 'D:\Scripts\temp\New Folder\noexit.ps1'" --- Shay Levy Windows PowerShell MVP http://blogs.microsoft.co.il/blogs/ScriptFanatic ss> As the example that follows shows you will have to use a back-tick ss> to escape the space in your file path. ss> ss> powershell.exe -noexit (&"d:\labs\new` folder\fixeddrivedata.ps1") ss> |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Script Error with Path....ODD | PowerShell | |||
| Pls doc how to execute an app that has embbedded space in its path | PowerShell | |||
| script with spaces in the path | PowerShell | |||
| How do I add to my PATH in a script? | PowerShell | |||
| how to get path and name of the active Script | PowerShell | |||