Please note that Start will open a new window to run the program. If the new window does not exit normally, your batch processing will not be able to execute normally. Therefore, if you use Start to enable the dir command, you must write the dir command into a batch processing file, and add the exit command at the end of the batch processing file.
The correct usage should be like this:
1. Create a batch processing using the dir command such as test.bat:
@echo off
dir c:\
rem ....Other operations
exit
2. Call this batch processing in another batch processing:
...
start /wait call test.bat
...
In fact, there is no need to use start /wait here, because after using the call command, test.bat has controlled the process, and it will definitely continue to the next operation after the call ends.
Start syntax:
Start another window to run the specified program or command.
START
"title" The title displayed in the window title bar.
path Starting directory
B Start the application without creating a new window. Unless
Start ^C processing is enabled, otherwise the application will ignore ^C processing;
^Break is the only way to interrupt the application
I The new environment is the original environment passed to cmd.exe,
instead of the current environment
MIN Minimize the window when starting
MAX Maximize the window when starting
SEPARATE Start 16-bit Windows programs in separate memory spaces
SHARED Start 16-bit Windows programs in shared memory spaces
LOW Start the application in the IDLE priority category
NORMAL Start the application in the NORMAL priority category
HIGH Start the application in the HIGH priority category
REALTIME Start the application in the REALTIME priority category
ABOVENORMAL Start the application in the ABOVENORMAL priority category
BELOWNORMAL Start the application in the BELOWNORMAL priority category
WAIT Start the application and wait for it to end
command/program
If it is an internal cmd command or a batch file, then the command processor is
Run cmd.exe with the /K command line switch. This means that the window remains after the command runs
exist.
If it is not an internal cmd command or a batch file, then it is a program, and
Run as a window application or console application.
parameters These are the parameters passed to the command/program
If command extensions are enabled, external command calls through the command line or START command
The call will change as follows:
Type the file name as a command, and non-executable files can be called through file associations.
(For example, WORD.DOC will call the application associated with the .DOC file extension).
For how to create these associations from inside the command script, see ASSOC and
FTYPE command.
When the executed application is a 32-bit GUI application, CMD.EXE does not wait for the application
The program terminates and returns to the command prompt. If it is executed in a command script, this new behavior
Then it doesn't happen.
If the first symbol of the executed command line is a string "CMD" without extension or path modifier, "CMD" will be replaced by the value of the COMSPEC variable. This
This prevents CMD.EXE from being extracted from the current directory.
If the first symbol of the executed command line has no extension, CMD.EXE will use
The value of the PATHEXT environment variable is used to determine the order in which which extensions
Name. The default value of the PATHEXT variable is:
.COM;.EXE;.BAT;.CMD
Please note that this syntax is the same as the PATH variable, separated by semicolons.
When looking for an executable file, if there is no matching extension, look at whether the name matches
Matches the directory name. If so, START will call Explorer on that path. If executed from the command line, it is equivalent to CD /D on that path.
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“
这个帖子”和“
这个帖子”并努力遵守,如果可能,请告诉更多的人!