Idera nSoftware Compellent

Stopping a Program Whenever You Feel Like It

When you launch a program using Start-Process with -passThru, you will get back the process object representing the started program. You can then use this object later to kill the program whenever necessary.

$notepad = Start-Process notepad -passthru
Start-Sleep 2
Stop-Process -inputObject $notepad

Twitter This Tip! ReTweet this Tip!


Posted Mar 02 2010, 08:00 AM by ps1
Copyright 2010 PowerShell.com. All rights reserved.