Launching Files with Arguments

by May 28, 2009

Often, you want to submit additional arguments to a program file when you launch it, such as you want to open IE and have it navigate to some Web site.

One way is to navigate to the folder that the program file resides in, and then call the file with a relative path like this:

cd "$env:programfilesInternet Explorer"
.iexplore.exe www.powershell.com

Or, you quote the file path (necessary when it contains spaces), call it with the "&" operator and add the arguments required like this:

& "$env:programfilesInternet Exploreriexplore.exe" www.powershell.com