问题
This is about the START command in batch-files.
start notepad \\ opens the notepad but not the command prompt
start www.google.com \\ opens the google.com but not the command prompt
start hurry.bat\\ starts executing the batch file but opens the command prompt
Why so? Any reason ? Thank you in advance.
回答1:
notepad.exe
is a graphic user inteface (GUI) program: it interacts with the user in GUI and doesn't need the console window (command prompt).
www.google.com
is interpreted as an internet address, and in order to process it (open the corresponging internet page) Windows calls your default browser, which is a GUI program too, like notepad
, so, again, no command prompt needed.
Now, a batch file is merely a text file containg a set of commands, a script. It cannot execute by itself and needs a program to interprete the commands. CMD.EXE
(the 'command prompt') is exactly the program that does that job.
来源:https://stackoverflow.com/questions/6688738/why-does-it-open-command-prompt-when-i-excute-start-hurry-bat