How do I make a command in a batch file not prompt to front?
I have a bat file contains the following commands.
start /WAIT /d "C:\Program Files\7-Zip" 7z.exe u -ms=off "D:\7zbackup\android.7z" "C:\xampp\htdocs\android"
start /WAIT /d "C:\Program Files\7-Zip" 7z.exe u -ms=off "D:\7zbackup\aspnet.7z" "C:\xampp\htdocs\aspnet"
start /WAIT /d "C:\Program Files\7-Zip" 7z.exe u -ms=off "D:\7zbackup\bitbucket.7z" "C:\xampp\htdocs\bitbucket"
start /WAIT /d "C:\Program Files\7-Zip" 7z.exe u -ms=off "D:\7zbackup\bitbucket_sourcetree.7z" "C:\xampp\htdocs\bitbucket_sourcetree"
It will prompt a cmd window to the front for each line of the command. How do I make it not prompt and run minimized or run in the background?
Solution 1:
Use start
with parameter '/B':
start /B /WAIT /d "C:\Program Files\7-Zip" 7z.exe u -ms=off "D:\7zbackup\android.7z" "C:\xampp\htdocs\android"
/b
: Starts an application without opening a new command prompt window. Ctrl + C handling is ignored unless the application enables Ctrl + C processing. Use Ctrl + Break to interrupt the application. (Start (TechNet).)
Solution 2:
It is your use of start
which causes the new window to appear.
7z
is 7-Zip's command-line program, so it can be called directly:
"C:\Program Files\7-Zip\7z.exe" u ...
This way everything stays within the original window.