I have a .js file that I am not allowed to modify. I can execute it by opening cmd.exe and entering the following:
cscript my_script.js
When I do that, the script runs to completion, and once it is done, it keeps the command prompt open so that I can read its output.
Since I don't want to go through those steps every time I need to execute a .js file, I rick clicked my_script.js
, selected the "Open with" option, and set cscript.exe as the default program to run .js files.
After doing that, I am now able execute my_script.js
by double clicking it. This is exactly what I wanted, but a new issue has arisen: once my_script.js
finishes executing, the command prompt where the output is displayed closes automatically.
I have read the answers to other questions that describe how to fix this issue, but none of them apply to my particular situation (I am not allowed to modify the .js file).
Is there a way to keep the command prompt open after the .js file finishes executing?
CMD
to be useful, specifically the/K
switch.