Question Locked

CMD Prompt: Exit Required?

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
It used to be required to issue the EXIT command to close a Command session otherwise it would be left running. Is this no-longer necessary? Does terminating the window now also exit the session as well?

6 replies

by p.j.hutchison

Yes, you can use either the Close Window or exit command to close the session, although if you use Command.com instead of Cmd.exe then running Exit is preferred.

by rob miners

Syntax:

EXIT

Purpose: Exits a secondary command processor.

Discussion

This command can be used when you are running an application program and want to start the DOS command processor, then return to your program. For example, to look at a directory on drive B while running an application program, you must start the command processor by typing COMMAND in response to the default drive prompt. You can now type the DIR command and DOS will display the directory for the default disk. When you type EXIT, you return to the previous level (your application program).

Example

If you start a new command processor by entering

command /c

then you can return to the previous command processor by entering

exit

It really depends on the type of batch file that you are running as to whether it will automatically exit when the commands have been completed. If you run cmd and open a window when you type in exit it will end the session.

Terminating a session will close it as well.

If you are using the goto syntax it is wise to direct it to :END to close the session.

Keep us informed as to your progress if you require further assistance.

If you think that any of the posts that have been made by all TR Members, have solved or contributed to solving the problem, please Mark them as Helpful so that others may benefit from the outcome. ;) :D

by jay

Of course in batch files it is necessary. My question relates more to user session windows. It used to be stressed NEVER to simply close the window as this would leave the session running. (NT) Because we don't see this stressed anymore can we safely assume that closing the window now also terminates (exits/kills) the session?

by rob miners

the session. You can CTRL+C to stop the batch process or close the window.

Keep us informed as to your progress if you require further assistance.

If you think that any of the posts that have been made by all TR Members, have solved or contributed to solving the problem, please Mark them as Helpful so that others may benefit from the outcome. ;) :D

This discussion is closed to new replies.