Launching Applications

by Aug 11, 2011

When you launch *.exe-applications with arguments, you may get exceptions because PowerShell may misinterpret the arguments. A better way to do this is using Start-Process and then separate file path and arguments with the parameters -FilePath and -ArgumentList. This way, you can safely enclose the arguments in quotes, too.

Start-Process -FilePath notepad -ArgumentList "$env:windir\system32\drivers\etc\hosts"

Twitter This Tip!
ReTweet this Tip!