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
Thread starter Title Forum Replies Date
G How to? Trying to create TCC shortcut that opens with blue background (on Windows 8.1 x64) Support 1
Joe Caverly Create Windows Jobs and optionally attach processes to a job Support 17
E How to? Create a portable version of TCMD to use on other computers w/o installation Support 4
Alpengreis Fixed 0xc0000005 while try to create a button (Schaltfläche) Support 4
MickeyF create an alias with optional parameter Support 4
S Problems to create new threads Support 6
C How to? create a JPSoft BTM menu to run custom custom batch files Support 2
A How to? Create a date range based upon creation date Support 2
S How to? Change thread prefix? Easy "create thread" method? Support 8
Stefano Piccardi Why did Windows create an encryption key? Support 5
S Create links or junctions on network drive Support 5
Jay Sage How Can SENDMAIL Create Messages with Plain Text and HTML Support 2
G create standalone .exe? Support 1
Charles Dye Create empty registry value? Support 5
vefatica Literal double quotes in SHORTCUT's "args" parameter? Support 6
D The SHORTCUT command again,.. Support 16
C How to bypass UAC warning when shortcut in \Startup folder ? Support 9
D [cosmetic] Shortcut for v24 still has v23 in its comment Support 1
vefatica New Shortcut Key box Support 1
M TCC Taskbar Shortcut Breaks Support 1
C How to? SHORTCUT question..... Support 6
R Shortcut key assignments - default Support 0
vefatica Shortcut/start-up folder nonsense Support 20
samintz How to? Use tilde shortcut Support 3
vefatica Keeping taskbar-pinned shortcut? Support 6
vefatica Update removes pinned shortcut? Support 17
vefatica Must update remove my taskbar-pinned shortcut? Support 20
vefatica Update removes taskbar-pinned shortcut Support 7
A Limitation regarding creation of shortcut keys for "copy" Support 0
nickles How to? Shortcut evaluation Support 5
vefatica SHORTCUT behavior (Win7) Support 3
C starting a shortcut from desktop Support 14
N Shortcut stops working after 4NT to TCC Upgrade Support 73
S SHORTCUT command question Support 1
S Desktop Shortcut Hotkey question Support 1
S SHORTCUT command failure Support 1
S Desktop hotkey creation using SHORTCUT command Support 4
D Always get shortcut in Start Menu folder Support 6
S OT: WinXP shortcut vs. junctions Support 2
M "Shortcut key" on Windows start menu shortcuts Support 5
E Bug in shortcut command Support 2
L WAD ECHO. expansion of non-existent env-vars differs from CMD.exe Support 6
M How to make Lua modify env-vars Support 18
MickeyF how to work with env var with special characters in the name Support 5
D Redirection to clip - env dependency? Support 3
C Env vars in tcmd.ini Support 12
N Can't set an env variable via pipe Support 8

Similar threads