One way to work around this is by following this steps:
Purpose: The point of this is to make the window stay open when you run a batch file.
- Windows Key + R
- type regedit in the window
- Back up Registry
- File
- Export>
- Save somewhere you can find it in case you need to revert
- Click the Plus sign next to HKEY_CLASSES_ROOT
- scroll to batfile
- Click the little plus next to it
- Click the little plus next to shell
- Click the little plus next to open
- Click the folder command
- For the REG_SZ on the right window double click the (Default)
- Make sure the string looks like this:
- "cmd.exe" /k "%1" %*
Now to explain, what I have set it to do is to basically keep the window open after running so you are returned to a command prompt.
Another place I find this to be very helpful is for example if you're using perl scripts right?
How many times do you run a perl script (to test) just by double clicking on it, and it opens calls an error and closes before you get a chance to even look at it?
Almost all the same steps as you'll see:
- Windows Key + R
- type regedit in the window
- Back up Registry
- File
- Export>
- Save somewhere you can find it in case you need to revert
- Click the Plus sign next to HKEY_CLASSES_ROOT
- scroll to Perl
- Click the little plus next to it
- Click the little plus next to shell
- Click the little plus next to open
- Click the folder command
- For the REG_SZ on the right window double click the (Default)
- Make sure the string looks like this:
- "cmd.exe" /k "perl %1" %*
The beauty of this is it can be applied to almost any script/exe etc. additionally you could add other arguments, for example if you want your perl scripts to always run in "debug" mode to give you the most information when you run a script (in case it fails) that would be a -w right in front of the %1:
- "cmd.exe" /k "perl -w %1" %*