DOS Windows Problems -- Please Help

J

Joe Hardin

I have a Win 2000 server that is very stable and has been running without
any problems for over a year. I need to run a dos batch file on it once a
day to do some maint. The batch file runs correctly, but the DOS Window
will not close when the batch file is complete. Therefore, if the batch
file runs 3 days in a row, then 3 windows will be open on the desktop when
you check the server.

I have researched this in the KB, but I can't find exactly what the solution
is. Can anyone please tell me, how to get the DOS window to close when the
batch file has completed it's run?


Thanks for all your help,

Joe Hardin
(e-mail address removed)
 
D

Dave Patrick

Should happen by default. Post the contents of the file.

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
|I have a Win 2000 server that is very stable and has been running without
| any problems for over a year. I need to run a dos batch file on it once a
| day to do some maint. The batch file runs correctly, but the DOS Window
| will not close when the batch file is complete. Therefore, if the batch
| file runs 3 days in a row, then 3 windows will be open on the desktop when
| you check the server.
|
| I have researched this in the KB, but I can't find exactly what the
solution
| is. Can anyone please tell me, how to get the DOS window to close when
the
| batch file has completed it's run?
|
|
| Thanks for all your help,
|
| Joe Hardin
| (e-mail address removed)
|
|
 
R

Rob Stow

Joe said:
I have a Win 2000 server that is very stable and has been running without
any problems for over a year. I need to run a dos batch file on it once a
day to do some maint. The batch file runs correctly, but the DOS Window
will not close when the batch file is complete. Therefore, if the batch
file runs 3 days in a row, then 3 windows will be open on the desktop when
you check the server.

I have researched this in the KB, but I can't find exactly what the solution
is. Can anyone please tell me, how to get the DOS window to close when the
batch file has completed it's run?

It can depend on how the batch file is started.

If you have something in your startup folder or one of your
registry Run keys that calls the batch file directly, then
the batch file should run and then close. However, if it
calls cmd.exe with the batch file as one of the parameters
for cmd.exe, then it may or may not close the CMD.exe window
when done.

Example:
1.) cmd.exe /c "my batch file.cmd"
Opens a cmd.exe window, runs the batch file, then closes.
2.) cmd.exe /k "my batch file.cmd"
Opens a cmd.exe window, runs the batch file, then STAYS
 
L

Lanwench [MVP - Exchange]

Rob said:
It can depend on how the batch file is started.

If you have something in your startup folder or one of your
registry Run keys that calls the batch file directly, then
the batch file should run and then close. However, if it
calls cmd.exe with the batch file as one of the parameters
for cmd.exe, then it may or may not close the CMD.exe window
when done.

Example:
1.) cmd.exe /c "my batch file.cmd"
Opens a cmd.exe window, runs the batch file, then closes.
2.) cmd.exe /k "my batch file.cmd"
Opens a cmd.exe window, runs the batch file, then STAYS

In addition, is it not possible for you to schedule the batch file to run
via task scheduler?
 
J

Joe Hardin

Thanks to everyone for the comments. I am running the batch file with the
scheduler and it executes perfectly alright, but the window just doesn't
close. So that you will know, the batch file contains 2 lines to execute 2
different backups. I have placed at the beginning of each line, start /w ,
in order to run 1 backup, then when it's fininshed to run the other. But
again, when the backups run, the window remains open after the jobs are
completed.

Another thing that confuses me about all of this, I have an XP machine that
I do the very same thing on, and it's dos window closes when the backups are
completed, but on the Win 2000 server it does not. That's had me confused
because as each of you know, on Win 95 --- 98 you could change a setting to
close the window, but that went away with Windows 2000.

Does anyone have any more ideas?

Thanks again,

Joe
(e-mail address removed)


"Lanwench [MVP - Exchange]"
 
D

Dave Patrick

Try as the last line;
exit

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
| Thanks to everyone for the comments. I am running the batch file with the
| scheduler and it executes perfectly alright, but the window just doesn't
| close. So that you will know, the batch file contains 2 lines to execute
2
| different backups. I have placed at the beginning of each line, start /w
,
| in order to run 1 backup, then when it's fininshed to run the other. But
| again, when the backups run, the window remains open after the jobs are
| completed.
|
| Another thing that confuses me about all of this, I have an XP machine
that
| I do the very same thing on, and it's dos window closes when the backups
are
| completed, but on the Win 2000 server it does not. That's had me confused
| because as each of you know, on Win 95 --- 98 you could change a setting
to
| close the window, but that went away with Windows 2000.
|
| Does anyone have any more ideas?
|
| Thanks again,
|
| Joe
| (e-mail address removed)
|
|
| "Lanwench [MVP - Exchange]"
message
| | > Rob Stow wrote:
| >> Joe Hardin wrote:
| >>> I have a Win 2000 server that is very stable and has been running
| >>> without any problems for over a year. I need to run a dos batch
| >>> file on it once a day to do some maint. The batch file runs
| >>> correctly, but the DOS Window will not close when the batch file is
| >>> complete. Therefore, if the batch file runs 3 days in a row, then 3
| >>> windows will be open on the desktop when you check the server.
| >>>
| >>> I have researched this in the KB, but I can't find exactly what the
| >>> solution is. Can anyone please tell me, how to get the DOS window
| >>> to close when the batch file has completed it's run?
| >>>
| >>
| >> It can depend on how the batch file is started.
| >>
| >> If you have something in your startup folder or one of your
| >> registry Run keys that calls the batch file directly, then
| >> the batch file should run and then close. However, if it
| >> calls cmd.exe with the batch file as one of the parameters
| >> for cmd.exe, then it may or may not close the CMD.exe window
| >> when done.
| >>
| >> Example:
| >> 1.) cmd.exe /c "my batch file.cmd"
| >> Opens a cmd.exe window, runs the batch file, then closes.
| >> 2.) cmd.exe /k "my batch file.cmd"
| >> Opens a cmd.exe window, runs the batch file, then STAYS
| >
| > In addition, is it not possible for you to schedule the batch file to
run
| > via task scheduler?
| >
| >
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top