Search notes:

System.Diagnostics.Process - Start()

Start a console process (cmd.exe)

The following example starts a process (cmd.exe) in a new console:
$psi = new-object System.Diagnostics.ProcessStartInfo

$psi.UseShellExecute  = $true
$psi.WorkingDirectory = $env:userprofile

$psi.FileName         = 'cmd.exe'
$psi.Arguments        = '/k echo Working directory is %cd%'

$proc = [System.Diagnostics.Process]::Start($psi)

write-host "process id is $($proc.id)"
Github repository .NET-API, path: /System/Diagnostics/Process/Start/new-console.ps1

Start a GUI process

The following example starts a GUI process (explorer.exe).
$psi = new-object System.Diagnostics.ProcessStartInfo

$psi.FileName  = 'explorer.exe'
$psi.Arguments = $env:userprofile

$proc = [System.Diagnostics.Process]::Start($psi)
Github repository .NET-API, path: /System/Diagnostics/Process/Start/gui.ps1

See also

System.Diagnostics.Process

Index