I'm not sure if this is going to be a programming question or not - it really depends on the answer I guess.
I have command-line utility that can be triggered by dropping a file onto it.
When this occurs, essentially this triggers the process as:
myUtility.exe Filepath/FileName.xyz
I'd like to retain the drag/drop facility, but include a fixed set of options:
myUtility.exe Filepath/FileName.xyz -f -g
Is there a way to do this?
Note the only variable is the filepath/filename of the dropped file. I cannot modify the utility.exe itself.
I'm wondering if a batch-file can be created to act as a man-in-the-middle so that the file is dropped onto a short-cut leading to the batch-file instead, this captures the dropped filename and then calls the utility.exe with the filename adding the required options.
If the -f -g do not need to come after the file name, you can just add the-f -g to your shortcut to the utility target field. The file name will be added as the third parameter automatically when drag and dropped onto the shortcut. Many good command line applications can handle their option parameters in any order.
C:\path to utility\myUtility.exe -f -g
Otherwise, yes you can create a batch file to arrange these values as needed. Add this to a .bat file and save it. A file dropped onto the script directly or onto its shortcut will be placed where the %1 is located.
C:\path to utility\myUtility.exe %1 -f -g
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With