How to? Create shortcut with env var in path

Apr 29, 2009
Redmond, WA
I'm trying to create a shortcut with an environment variable in the path of the target.
[C:\Temp]shortcut "%%tools%%\apps\tcmd\tcc.exe" "" "" "Take Command Console" "Take Command Console.lnk" 1 "%tools%\apps\tcmd\tcc.exe" 0

But this results in a shortcut with the target: C:\Temp\%tools%\apps\tcmd\tcc.exe
Instead of the desired: %tools%\apps\tcmd\tcc.exe
May 20, 2008
Syracuse, NY, USA
The help says "Command is the full path of the executable file to start". You apparently don't want %tools% to be resolved when the shortcut is created, so perhaps TCC is trying to turn your specification (as it should?) into a full path.

Charles Dye

Super Moderator
Staff member
May 20, 2008
Albuquerque, NM
I don't want to blow my own horn, but instead of SHORTCUT you could use MKSC (in UIStuff) and specify the /NC option, which bypasses the step of canonicalizing the target filename. (In your particular case you don't even need /NC; the command is smart enough to recognize that filenames beginning with a percent sign and a letter should not be canonicalized.)

Similar threads