PowerShell 2.0: One Cmdlet at a Time 14 Start-Process
Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Start-Process cmdlet.
What can I do with it?
Start a process on the local computer.
Examples:
Start an instance of Notepad
Start-Process Notepad
Open the file Test.txt using its associated application Notepad
Start-Process C:\Scripts\Test.txt
How could I have done this in PowerShell 1.0?
You could have used the .NET System.Diagnostics.Process class and the Start method.
[System.Diagnostics.Process]::Start(“Notepad”)
and to open a specific file with Notepad
[System.Diagnostics.Process]::Start(“Notepad”,“C:\Scripts\Test.txt”)
Alternatively you could have used WMI and this option would also give you the ability to start a process on a remote computer.
([WMICLASS]"\\Server01\ROOT\CIMV2:win32_process").Create(“Notepad”)