Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Using ProcessStartInfo with [System.Diagnostics.Process]::Start

Reply
 
Old 08-11-2006   #1 (permalink)
Brandon Shell


 
 

Using ProcessStartInfo with [System.Diagnostics.Process]::Start

I want to be able to control the application that is started using this
method. Any ideas on how to setup a ProcessStartInfo that I can pass to
[System.Diagnostics.Process]::Start?

http://msdn2.microsoft.com/en-us/lib...ess.start.aspx



My System SpecsSystem Spec
Old 08-11-2006   #2 (permalink)
Alex K. Angelopoulos [MVP]


 
 

Re: Using ProcessStartInfo with [System.Diagnostics.Process]::Start

Check back a few days and you'll see a post I made demoing an "Invoke-Halo"
script that does exactly this. In general form, here's how it works:

$psi = New-Object System.Diagnostics.ProcessStartInfo
$psi.Filename = ... # name or complete path
$psi.Arguments = ... # complete argument string.

Here's a Start-Process function I wrote that handles 2 of the
ProcessStartInfo properties:

function Start-Process
{
Param([string]$Filename,[string]$ArgumentString = [System.String]::Empty)
$si = New-Object System.Diagnostics.ProcessStartInfo
$si.Filename = $Filename;
if($ArgumentString){$si.Arguments = $ArgumentString};
$si.Filename, $si.Arguments;
[System.Diagnostics.Process]::Start($si);
}

"Brandon Shell" <tshell.mask@gmail.com> wrote in message
news:Ou7cmNXvGHA.4384@TK2MSFTNGP04.phx.gbl...
>I want to be able to control the application that is started using this
>method. Any ideas on how to setup a ProcessStartInfo that I can pass to
>[System.Diagnostics.Process]::Start?
>
> http://msdn2.microsoft.com/en-us/lib...ess.start.aspx
>
>



My System SpecsSystem Spec
Old 08-11-2006   #3 (permalink)
Brandon Shell


 
 

Re: Using ProcessStartInfo with [System.Diagnostics.Process]::Start

You rock my man... that was exactly what I was looking for.

"Alex K. Angelopoulos [MVP]" <aka@online.mvps.org> wrote in message
news:eNrtjfXvGHA.1772@TK2MSFTNGP06.phx.gbl...
> Check back a few days and you'll see a post I made demoing an
> "Invoke-Halo" script that does exactly this. In general form, here's how
> it works:
>
> $psi = New-Object System.Diagnostics.ProcessStartInfo
> $psi.Filename = ... # name or complete path
> $psi.Arguments = ... # complete argument string.
>
> Here's a Start-Process function I wrote that handles 2 of the
> ProcessStartInfo properties:
>
> function Start-Process
> {
> Param([string]$Filename,[string]$ArgumentString = [System.String]::Empty)
> $si = New-Object System.Diagnostics.ProcessStartInfo
> $si.Filename = $Filename;
> if($ArgumentString){$si.Arguments = $ArgumentString};
> $si.Filename, $si.Arguments;
> [System.Diagnostics.Process]::Start($si);
> }
>
> "Brandon Shell" <tshell.mask@gmail.com> wrote in message
> news:Ou7cmNXvGHA.4384@TK2MSFTNGP04.phx.gbl...
>>I want to be able to control the application that is started using this
>>method. Any ideas on how to setup a ProcessStartInfo that I can pass to
>>[System.Diagnostics.Process]::Start?
>>
>> http://msdn2.microsoft.com/en-us/lib...ess.start.aspx
>>
>>

>
>



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
[diagnostics.process]::start("exe") PowerShell
redirecting standar output when using [System.Diagnostics.Process]::Start PowerShell
Question about [System.Diagnostics.Process]::Start() PowerShell
Wrap command shell in System.Diagnostics.Process PowerShell
Stupid [Diagnostics.Process]::Start("..") tricks PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46