Creating Command Prompt Shortcut with Specified Environment Path on Windows

Sometimes you might want to have a command prompt with the specified command such as php available, without specified the full path to the executable and without altering the system or user environment variables.

There are several ways to achieve this, and here is the simple way I liked to use.

  1. Make a copy of the Command Prompt shortcut in your start menu
  2. Right click on the new shortcut and click Properties
  3. In the Shortcut tab, append the following content into the Target text box. Make sure you got a space before /k
     /k "set path=%path%;C:\bin\php54"
  4. Replace the part C:\bin\php54 with the path to the folder where your executable files are located

At the end you will have something like this:

Command Prompt Shortcut