Launching Files without Specifying a Path

by May 26, 2009

For security reasons, PowerShell launches files only when specified with a relative or absolute path name. The only exceptions to this rule are files located in folders listed in the %PATH% environment variable.
To add a new folder path to your %PATH% environment variable, such as a personal folder with PowerShell scripts you use often, use this command:

#replace the path with the path to your folder
$env:path += ';c:…'

This command changes the process environment variables so it cannot mess up anything and is valid only in your current PowerShell session. However, you can add it to your autostart profile scripts if you'd like to use it permanently within PowerShell.

Once you added a folder to %PATH%, any file located inside of this folder can be called directly without a relative or absolute path name, just like calc.