I posted about this before but it turns out my initial idea that quoting didn't work was wrong. You *can* have embedded double-quotes in the arguments to the SHORTCUT command. Forget escaping, just concatenate them. (Thanks, Vince.)
What you *cannot* have is %envar% expansion. The WINAPI allows them, PowerShell supports it, you can put them in manually, but TC doesn't allow them in the arguments to the SHORTCUT command.
I will post a change request in the appropriate forum.
I might want them in the hyperlink fields for program, arguments or working directory. They are very useful in situations where programs and data are not always in the same location on different machines, for different users or memory devices. The shortcuts remain the same under different circumstances. But you know that, so... what is it you're asking?
Your point in example is my point: it doesn't work, but it should. It is a limitation imposed by TC, not windows. This limitation serves no purpose that I am aware of.
Is that the only point? It has nothing to do with environment variables. Envvars work normally with the SHORTCUT command; %varname% is expanded immediately and %%varname%% puts %varname% into the shortcut's properties. The only problem I can find is TCC's prepending drive:\ to something that doesn't look like a fully-qualified name. As far as I can tell, that's the only place using %%envvar%% causes trouble.
The help says the target must be fully-qualified. I think TCC should leave that to the user and not try to be helpful.
I just dug out the source for my MKSC command, and its default behavior is to canonicalize the target filename unless the first character is a percent sign and the second is a letter. I guess my assumption was that an environment variable would almost always come at the start of the target name.
I'm not sure now whether that was a clever assumption or a stupid one, but it is a very simple test. It would probably take Rex, oh, about 90 seconds to implement something similar in SHORTCUT.
It does seem like a lot of hoopla about something not quite complicated.
I am a little worried though, that the discussion seems to zoom-in on the "command" argument to SHORTCUT. In my experience, it also doesn't allow %envar% in the "arguments" and "directory" ... parts. There are no helpful error messages however, so the user is left guessing what goes wrong where.
Here, SHORTCUT tries to canonicalize the "command" and "directory" args, even if they contain a variable reference. The "args" arg, however, is left alone:
Here's another. You see that it handles the environment variables correctly. As far as I can tell, the only thing that's undesirable is the prepending of a drive specification.
Thanks, guys. This is helpful (in a way) in that the examples that work on your end fail at mine. Pffft. Thank goodness. Só glad it is not something obvious. I just know this is gonna hurt!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.