Re chenxi:
Essentially speaking, exit is a DOS internal command, so it definitely cannot close the window that Windows allocates for DOS. When some people say that typing "exit" closes the window, that's only a side effect: exit first terminates the nested inner DOS shell, and only then can Windows automatically reclaim the outer DOS shell.
To put it more vividly, the outer DOS shell is the DOS window, while there can be many kinds of inner DOS shells; simply typing command nests one more shell. A typical case is that command nests a shell in order to interpret and execute a batch file, so you may see exit in some batch files, but this is not required.
The following is the explanatory text for the exit command, excerpted from the pdos6.22 help document.
----------------------------------------------------------------------------------------------------
EXIT
If the program that started the command interpreter exists, exits the MS-DOS command interpreter (COMMAND.COM)
and returns to that program.
Syntax
EXIT
----------------------------------------------------------------------------------------------------
EXIT—Notes
EXIT is for the command interpreter
When you use the MS-DOS COMMAND command to start a new command interpreter session, you can use the EXIT command to
return to the old command interpreter. Likewise, when you run certain programs, you can also run the MS-DOS
command interpreter from within the program, and then use the EXIT command to return to your program. For detailed information about the command interpreter, please
refer to the command.
If you did not use the /P (permanent) switch on the original copy of COMMAND.COM, then the EXIT command will
exit the command interpreter. After that, you must specify the location of the COMMAND.COM file at the command prompt in order to
start the command interpreter again.
Using EXIT when the command program is loaded permanently
If you started the COMMAND.COM program with the /P (permanent) switch, then EXIT will not work.
※ Batchinger 致 Bat Fans:请访问
批处理编程的异类 ,欢迎交流与共享批处理编程心得!