I have a shortcut to a .BAT file (or any kind of DOS application). I need after its execution, DOS window not to close until i read the output of the program(s).
Adding a line with pause in the end of file is not an option (my file stays in VCS).
Solution: You could change the command of shortcut from this:
c:\path\shortcut.bat
to this:
c:\path\shortcut.bat & pause
You will get an message "Press any key to continue" and you will read the output of the program.
Showing posts with label DOS. Show all posts
Showing posts with label DOS. Show all posts
Friday, November 27, 2015
Monday, March 12, 2012
Redirecting output in MS DOS
I need to redirect the error output to file also. This can be done with
For example:
command > certpath.txt 2>&1
For example:
java -Djava.security.debug=certpath -jar target\xxx-2.0-SNAPSHOT-jar-with-dependencies.jar > certpath.txt 2>&1
Friday, August 12, 2011
Easier Command prompts recognition
If you use more that one Command Prompts in Windows, you probably mess them up. An easy way to distinguish them is with color command. Write in each of them color command with different arguments. Letter color changes, yeah!
Command Prompt window #1:
Command Prompt window #2:
Command Prompt window #1:
color ACommand Prompt window #2:
color BMS DOS batch tips
So, by way of tribute to the dying art of the DOS Batch file, I present my top ten batch file tricks:
1 Use PUSHD / POPD to change directories
Read Scott Hanselman's writeup on PUSHD. The basic idea is that it keeps a stack, so at the simplest level you can do something like this:
That allows you to call the batch file from any directory and return to the original directory when you're done. The cool thing is that PUSHD can be nested, so you can move all over the place within your scripts and just POPD your way out when you're done.
1 Use PUSHD / POPD to change directories
Read Scott Hanselman's writeup on PUSHD. The basic idea is that it keeps a stack, so at the simplest level you can do something like this:
PUSHD "C:\Working Directory\" ::DO SOME WORK POPD
That allows you to call the batch file from any directory and return to the original directory when you're done. The cool thing is that PUSHD can be nested, so you can move all over the place within your scripts and just POPD your way out when you're done.
Subscribe to:
Posts (Atom)