How to pass a filename to a shortcut in Windows
Posted
by
Kendall Frey
on Super User
See other posts from Super User
or by Kendall Frey
Published on 2012-09-11T20:52:10Z
Indexed on
2012/09/11
21:41 UTC
Read the original article
Hit count: 315
I have a program program.exe
and a document document.txt
, and to open the document, I can drag document.txt
onto program.exe
. So far so good. Now I want to call it with a command-line parameter -param
so that the full command line is program.exe -param document.txt
Unfortunately, I can't do this with drag and drop, so I need to fire up cmd and type in the command manually. This takes too long, and I need an easier way.
How can I create a shortcut that I can drop the file onto, and have it call the program with the command-line parameter?
I tried setting the shortcut to program.exe -param "%1"
, but that didn't work, because it appeared to pass only the file name, and not the path, and since the current directory was the one with the program and not the one with the document, it couldn't find the document.
© Super User or respective owner