![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| | |||||||
| | Vista - Executing CMD.EXE from PowerShell |
| |
| 10-26-2007 | #1 (permalink) |
| | Executing CMD.EXE from PowerShell I'd like to be able to execute the following command: $p = [diagnostics.process]::Start("cmd.exe", "/c start /wait c:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.bat") $p.WaitForExit() The problem is, of course, is with the file path. When I run this command, I get this error: "Windows cannot find c:\Program. Make sure you typed the name correctly, and try again. To search for a file, click the Start button, and ten click Search." When I attempt to get the path recognized by wrapping it in single quotation marks, I get the same error. Any ideas as to how to fix this? Thanks, Stephen |
| My System Specs |
| 10-26-2007 | #2 (permalink) |
| | Re: Executing CMD.EXE from PowerShell I cant test this atm but this should work $p = [diagnostics.process]::Start("cmd.exe", "/c start /wait `"c:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.bat`"") $p.WaitForExit() Brandon Shell --------------- Blog: http://www.bsonposh.com/ PSH Scripts Project: www.codeplex.com/psobject SS> I'd like to be able to execute the following command: SS> SS> $p = [diagnostics.process]::Start("cmd.exe", "/c start /wait SS> c:\Program SS> Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.bat") SS> $p.WaitForExit() SS> The problem is, of course, is with the file path. When I run this SS> command, I get this error: SS> SS> "Windows cannot find c:\Program. Make sure you typed the name SS> correctly, and try again. To search for a file, click the Start SS> button, and ten click Search." SS> SS> When I attempt to get the path recognized by wrapping it in single SS> quotation marks, I get the same error. SS> SS> Any ideas as to how to fix this? SS> SS> Thanks, SS> SS> Stephen SS> |
| My System Specs |
| 11-01-2007 | #3 (permalink) |
| | Re: Executing CMD.EXE from PowerShell You might also need to escape the path if Brandon's suggestion didn't work: $p = [diagnostics.process]::Start("cmd.exe", "/c start /wait `"c:\Program Quote: > Files\Microsoft` Visual` Studio\VC98\Bin\VCVARS32.bat`"") "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message news:29d4f6461eef8c9e5f67b4f685a@xxxxxx Quote: >I cant test this atm but this should work > $p = [diagnostics.process]::Start("cmd.exe", "/c start /wait `"c:\Program > Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.bat`"") > $p.WaitForExit() > > Brandon Shell > --------------- > Blog: http://www.bsonposh.com/ > PSH Scripts Project: www.codeplex.com/psobject > > SS> I'd like to be able to execute the following command: > SS> SS> $p = [diagnostics.process]::Start("cmd.exe", "/c start /wait > SS> c:\Program > SS> Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.bat") > SS> $p.WaitForExit() > SS> The problem is, of course, is with the file path. When I run this > SS> command, I get this error: > SS> SS> "Windows cannot find c:\Program. Make sure you typed the name > SS> correctly, and try again. To search for a file, click the Start > SS> button, and ten click Search." > SS> SS> When I attempt to get the path recognized by wrapping it in single > SS> quotation marks, I get the same error. > SS> SS> Any ideas as to how to fix this? > SS> SS> Thanks, > SS> SS> Stephen > SS> > |
| My System Specs |
| Thread Tools | |
| |
| Similar Threads for: Executing CMD.EXE from PowerShell | ||||
| Thread | Forum | |||
| executing.............. | Live Mail | |||
| Executing PowerShell Scripts with IIS | PowerShell | |||
| Executing SQL queries from Powershell | PowerShell | |||
| executing powershell scripts on server | PowerShell | |||
| Executing Stored Procedure from Powershell | PowerShell | |||