Can I set an environment variable for an application using a shortcut in Windows?

user366203 picture user366203 · Jun 14, 2010 · Viewed 50.8k times · Source

I have a feeling I should be able add a directory to the PATH environment variable on an application-lifetime basis, but I can't find out how to do this. Is it possible to add a parameter to a Windows shortcut that appends a directory to the current value of PATH for use by the application being linked?

Answer

Jens picture Jens · Jan 13, 2016

As explained here: http://www.labs64.com/blog/2012/06/set-environment-variables-in-windows-shortcut/ you can do it without a bat file too.

Set Target to e.g.:

C:\Windows\System32\cmd.exe /c "SET path=%path%&& START /D ^"C:\Program Files (x86)\Notepad++^" notepad++.exe"

To avoid see the command prompt for a split second before it close again, you should set

Run: Minimized 

on the Shortcut tab

(Tested on Windows 7, Windows 10)