Discussion:
Using ProcessStartInfo with [System.Diagnostics.Process]::Start
(too old to reply)
Brandon Shell
2006-08-11 18:24:33 UTC
Permalink
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/library/system.diagnostics.process.start.aspx
Alex K. Angelopoulos [MVP]
2006-08-11 18:56:40 UTC
Permalink
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);
}
Post by Brandon Shell
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/library/system.diagnostics.process.start.aspx
Brandon Shell
2006-08-12 00:07:39 UTC
Permalink
You rock my man... that was exactly what I was looking for.
Post by Alex K. Angelopoulos [MVP]
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
$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
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);
}
Post by Brandon Shell
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/library/system.diagnostics.process.start.aspx
Loading...