Launching Files with Arguments

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:programfiles\Internet 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:programfiles\Internet Explorer\iexplore.exe" www.powershell.com

Posted May 28 2009, 08:00 AM by ps1
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.