![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | Question about [System.Diagnostics.Process]::Start() I am trying to figure out how to start a process with parameters. For example I can do [System.Diagnostics.Process]::Start("outlook") and Outlook launches. I would like to do [System.Diagnostics.Process]::Start("outlook / safe") But I get the following error PS > [System.Diagnostics.Process]::Start("outlook /safe") Exception calling "Start" with "1" argument(s): "The system cannot find the file specified" At line:1 char:36 + [System.Diagnostics.Process]::Start( <<<< "outlook /safe") Thanks Andy |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Question about [System.Diagnostics.Process]::Start() On Jul 21, 5:56 am, a...@nodisabilities.com wrote: > I am trying to figure out how to start a process with parameters. > > For example I can do [System.Diagnostics.Process]::Start("outlook") > and Outlook launches. > > I would like to do [System.Diagnostics.Process]::Start("outlook / > safe") > > But I get the following error > > PS > [System.Diagnostics.Process]::Start("outlook /safe") > Exception calling "Start" with "1" argument(s): "The system cannot > find the file specified" > At line:1 char:36 > + [System.Diagnostics.Process]::Start( <<<< "outlook /safe") > > Thanks > > Andy What you want is the overload of the Process.Start method that takes the arguments as the second parameter: [System.Diagnostics.Process]::Start( "outlook", "/safe" ) Good luck. Jeff |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Question about [System.Diagnostics.Process]::Start() Use System.Diagnostics.ProcessStartInfo and pass to System.Diagnostics.Process. This gives you a little more control of the process and its properties. $StartInfo = new-object System.Diagnostics.ProcessStartInfo $StartInfo.FileName = "outlook.exe" $StartInfo.Arguments="/safe" $StartInfo.LoadUserProfile = $false $StartInfo.UseShellExecute = $false $StartInfo.WorkingDirectory = (get-location).Path $proc = [System.Diagnostics.Process]::Start($StartInfo) Some good info here http://blogs.msdn.com/powershell/arc...owershell.aspx <andy@nodisabilities.com> wrote in message news:1184972219.099933.109360@i38g2000prf.googlegroups.com... >I am trying to figure out how to start a process with parameters. > > For example I can do [System.Diagnostics.Process]::Start("outlook") > and Outlook launches. > > I would like to do [System.Diagnostics.Process]::Start("outlook / > safe") > > But I get the following error > > PS > [System.Diagnostics.Process]::Start("outlook /safe") > Exception calling "Start" with "1" argument(s): "The system cannot > find the file specified" > At line:1 char:36 > + [System.Diagnostics.Process]::Start( <<<< "outlook /safe") > > Thanks > > Andy > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Question about [System.Diagnostics.Process]::Start() Perfect, that is just what I was looking for. Thanks! Andy Jeff wrote: > On Jul 21, 5:56 am, a...@nodisabilities.com wrote: > > I am trying to figure out how to start a process with parameters. > > > > For example I can do [System.Diagnostics.Process]::Start("outlook") > > and Outlook launches. > > > > I would like to do [System.Diagnostics.Process]::Start("outlook / > > safe") > > > > But I get the following error > > > > PS > [System.Diagnostics.Process]::Start("outlook /safe") > > Exception calling "Start" with "1" argument(s): "The system cannot > > find the file specified" > > At line:1 char:36 > > + [System.Diagnostics.Process]::Start( <<<< "outlook /safe") > > > > Thanks > > > > Andy > > What you want is the overload of the Process.Start method that takes > the arguments as the second parameter: > > [System.Diagnostics.Process]::Start( "outlook", "/safe" ) > > Good luck. > > Jeff |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Question about [System.Diagnostics.Process]::Start() As an alternative there is a start-process cmdlet in the PowerShell Community Extensions -- 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 "Brandon Shell" wrote: > Use System.Diagnostics.ProcessStartInfo and pass to > System.Diagnostics.Process. This gives you a little more control of the > process and its properties. > > $StartInfo = new-object System.Diagnostics.ProcessStartInfo > $StartInfo.FileName = "outlook.exe" > $StartInfo.Arguments="/safe" > $StartInfo.LoadUserProfile = $false > $StartInfo.UseShellExecute = $false > $StartInfo.WorkingDirectory = (get-location).Path > $proc = [System.Diagnostics.Process]::Start($StartInfo) > > Some good info here > http://blogs.msdn.com/powershell/arc...owershell.aspx > > <andy@nodisabilities.com> wrote in message > news:1184972219.099933.109360@i38g2000prf.googlegroups.com... > >I am trying to figure out how to start a process with parameters. > > > > For example I can do [System.Diagnostics.Process]::Start("outlook") > > and Outlook launches. > > > > I would like to do [System.Diagnostics.Process]::Start("outlook / > > safe") > > > > But I get the following error > > > > PS > [System.Diagnostics.Process]::Start("outlook /safe") > > Exception calling "Start" with "1" argument(s): "The system cannot > > find the file specified" > > At line:1 char:36 > > + [System.Diagnostics.Process]::Start( <<<< "outlook /safe") > > > > Thanks > > > > Andy > > > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| [diagnostics.process]::start("exe") | PowerShell | |||
| redirecting standar output when using [System.Diagnostics.Process]::Start | PowerShell | |||
| Wrap command shell in System.Diagnostics.Process | PowerShell | |||
| Using ProcessStartInfo with [System.Diagnostics.Process]::Start | PowerShell | |||
| Stupid [Diagnostics.Process]::Start("..") tricks | PowerShell | |||