Windows shortcut target parameter starting with an @

shortcutwindows

I have a Windows application that I need to invoke with a desktop shortcut and some command-line parameters.

I've done this thousands of times, but this one is a bit different. Instead of using a normal command-line parameter like -e 12345 or -example 12345, this one uses @12345 (starting with the @ symbol).

Windows shortcuts do not like this parameter coming immediately after the executable name, and it just strips everything out. I don't know why.

For example:

c:\example\example.exe @12345 -e9876 as the "target", when saving, strips out all the parameters and leaves just c:\example\example.exe as the target.

But c:\example\example.exe -e9876 @12345 works just fine. It saves, and validates, and everything is good.

However I need the @ parameter to be the first one on the command. Apart from doing something like wrapping the command in a batch file and calling the batch, how can I have an @ symbol be the first command line parameter on a Windows shortcut?

Best Answer

Who knew? ... Windows apparently treats the @ character as a delimiter. Windows commands will only interpret the first element in the command... so it effectively truncates the rest. Apparently, you can override the behavior by supplying a ^ before it to escape the symbol.

i.e.

c:\example\example.exe ^@12345 -e9876

Related Topic