Context: I have associated .batch extension to be opened by my text editor by default when double-clicking or hitting ENTER on it in the Explorer (default action for "Open").
(I probably can't do this directly for .bat files and it's probably not something we want, it could break other things).
Example:
helloworld.batch ================ dir md hello cd hello How to run this file from command line as if it were a .bat or .cmd?
Doing call helloworld.batch opens it in my editor, doing helloworld.batch in the command line does the same; idem for start helloworld.batch. How to actually run it?
PS: why do I want to achieve this? Let's compare these situations:
Before: Double click on
test.bat, run it. Oh no it hasn't worked as expected, and the window is now closed and I haven't seen the error (it went too fast)... I should have addedpauseat the end. Let's open it in the text editor. I edit it. I save, I close the editor. Let's double click ontest.batagain...After: Double-click on
test.batch, it opens in the text editor.CTRL+B, it runs and I see the output in the bottom panel of my editor. If there's something to copy/paste, I can (not possible incmd.exeby default even if I found a way). If there's something to modify in the batch I'm already in the editor... Life is good :) –
Start helloworld.batch?call.