Running .exe in command prompt
Solution 1:
This will leave the console window open even after MyApp.exe terminates:
cmd /K "C:\SomeFolder\MyApp.exe"
You can create a shortcut with the above. This solution works with all console programs and does not require you to go through Command Prompt every time (or modify the original exe which you usually can't).
Incidentally the /K
switch has been around since NT days :-p
Solution 2:
Another way, quite useful if the path to the .exe is a complicated one: Start the command prompt and then just drag the .exe file into the cmd window. The full path to the file will be pasted into the prompt and you just have to press enter. No need to cd into any paths.
Solution 3:
- Open command prompt -> Got to your
.exe
's location usingcd
command -> execute your.exe
- You can add
Console.ReadKey()
at the end of your code so that program will wait until the user presses some key.