Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Thank you for reading this - I'm trying to figure out how to get a cmd.exe window to close after a simple batch file has run. The batch file simply introduces a ping/timeout delay and then executes an FTP program (the idea being that the program loads on startup but waits until after XP is completely done booting and after another batch file has run before it starts).
The trouble is that once the focus is taken off of the command window to load the GUI of the FTP it ignores my exit command and leaves the command prompt window open which is kinda untidy. Here is the file (credit for the 270 second ping delay goes out to Secret_Doom and Nathan from these very forums):
*****START BATCH FILE*****
ping 1.1.1.1 -n 1 -w 270000
cd\Progra~1\G6 FTP Server
G6FTPSrv.exe
exit
*****END BATCH FILE*****I know it isn't fancy but it gets the job done... if only it would close the command prompt window when it was finished I would be happy. It seems to ignore everything after the exe is run. Thanks in advance for your assistance. :)

This sure sounded like an elegant solution but it didn't work for me. I tried dozens of variations but settled on:
*****START NT COMMAND SCRIPT*****
TIMEOUT 270
CMD /C "C:\Progra~1\G6 FTP Server\G6FTPSrv.exe"*****END NT COMMAND SCRIPT*****
I stewed and stewed over this but then noticed a little reference on the page you directed me to:
"In a batch script CMD will start a new instance of CMD.exe which will appear in the same window. The EXIT command will close the second CMD instance and return to the previous shell... Notice that where CMD /c is used, the EXIT command is not required.
"So I think this is in fact working in that it opens a new instance of cmd.exe in the same window, executes the program, and then exits back to the original instance of cmd.exe. Unfortunately this still leaves me with the original window open. :/

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |