I have authored a batch script that assumes %1
is a path to a file. At times I would like to use this batch script via drag-drop in Windows Explorer (dragging my target file onto my batch script file), and at other times I would like to run this batch script from an existing command prompt window and provide my %1
path explicitly (usually just a relative path).
I don't want my script to disappear immediately when "drag dropping", thus I need to pause
. However, I don't want to have to press any key to continue
every time when using an existing command prompt window, thus I don't want pause
.
Is there a way to have the best of both worlds? Can I somehow detect/infer the scenario I'm in, and decide to pause or not pause thereafter? What's the best approach here?