Deleting an EXE file with parameters

I'm not sure if this will be a programming question or not - it really depends on the answer I'm guessing.

I have a command line utility that can be launched by deleting a file on it.

When this happens, it essentially initiates the process as:

myUtility.exe Filepath/FileName.xyz

      

I would like to keep the drag object but include a fixed set of options:

myUtility.exe Filepath/FileName.xyz -f -g

      

Is there a way to do this?

Note that the only variable is the file path / filename with the discarded file. I cannot change the utility.exe file myself.

I am wondering if it is possible to create a batch file in order to act like a man in the middle so that the file is dumped to a short header resulting in the batch file, instead it displays the deferred filename and then calls the .exe utility with the filename appending the required parameters.

+3


source to share


1 answer


If you -f -g

don't need to go after the filename, you can just add -f -g

to your shortcut in the target utility field. The file name will be added as the third parameter automatically when dragged onto the shortcut. Many good command line applications can process their parameter 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. The file dropped on the script directly or on its shortcut will be placed where it is located %1

.

C:\path to utility\myUtility.exe %1 -f -g

      

+5


source







All Articles