Launch Windows program with custom environment variable

I think don't think you can do it in the shortcut itself, so the shortcut needs to point to something that sets the variable, and then lauches your program. Of course, there are infinite ways of doing that, but the command script is probably simplest.

If you use start command.exe in you bat file, you will get a command window flashing by, but it will not stick around.

Update: It actually works to put this as a shortcut target.

C:\Windows\System32\cmd.exe /c "set HOME=c:\ && start C:\Windows\System32\notepad.exe"

Update 2: That did not work with a space in the command path. But this does!

C:\Windows\System32\cmd.exe /c "set HOME=c:\ && path %path%;C:\Program Files (x86)\VideoLAN\VLC && start vlc.exe"

Note that set is only temporary, so you can just put the following in a batch:

set JAVA_HOME=
program.exe

Sorry for reviving an old thread, but I figured this could probably help people searching for a solution to this problem:

You can override you JAVA_HOME path directly in your FlexSDK. To do this, navigate to your SDK's bin/ folder (should be in C:\Program Files (x86)\FlashDevelop\Tools\flexsdk\ if you let the FD installer set it up for you, otherwise you probably know where it is) and open jvm.config.