View Single Post
Old 07-20-2007   #3 (permalink)
Brandon Shell


 
 

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 SpecsSystem Spec