How to code a batch file to close window?

E

Eric

Does anyone have any suggestions on how to code a batch file to close window?
Thanks in advance for any suggestions
Eric
 
S

Shenan Stanley

Eric said:
Does anyone have any suggestions on how to code a batch file to
close window? Thanks in advance for any suggestions

Depends on what you have available to you and what you mean by 'to close
window'.

You can kill a given task (which would *close* any associated windows.) Is
that what you want?
 
E

Eric

Thank you very much for suggestions
I mainly copy backup files into specific folders using batch file, which
take a while for copying, and I would like to shut down windows after copying
all files for backup.
Do you have any suggestions on how to do it?
Thank you very much for any suggestions
Eric
 
S

Shenan Stanley

Eric said:
Thank you very much for suggestions
I mainly copy backup files into specific folders using batch file,
which take a while for copying, and I would like to shut down
windows after copying all files for backup.
Do you have any suggestions on how to do it?
Thank you very much for any suggestions

So you have a batch script that copies files (xcopy or copy command line
command?) and you want the command prompt window to close when done?

EXIT

That would be the last line of your batch script.
 
D

Daave

Eric said:
Does anyone have any suggestions on how to code a batch file to close
window? Thanks in advance for any suggestions

"close window"

Would that be "window" or "Windows"? (As in Windows XP.)
 
B

Bob CP

Eric said:
Thank you very much for suggestions
I mainly copy backup files into specific folders using batch file, which
take a while for copying, and I would like to shut down windows after copying
all files for backup.
Do you have any suggestions on how to do it?
Thank you very much for any suggestions
Eric

:
http://www.computerhope.com/shutdown.htm

Add
shutdown -s
as the last line in your batch file.
 
S

Shenan Stanley

Eric said:
Does anyone have any suggestions on how to code a batch file to
close window? Thanks in advance for any suggestions

Shenan said:
Depends on what you have available to you and what you mean by 'to
close window'.

You can kill a given task (which would *close* any associated
windows.) Is that what you want?
Thank you very much for suggestions
I mainly copy backup files into specific folders using batch file,
which take a while for copying, and I would like to shut down
windows after copying all files for backup.
Do you have any suggestions on how to do it?
Thank you very much for any suggestions

Shenan said:
So you have a batch script that copies files (xcopy or copy command
line command?) and you want the command prompt window to close when
done?
EXIT

That would be the last line of your batch script.

Oh... Shutdown windows.

Before the "EXIT" command - put in the SHUTDOWN command in your batch
script.

Something like:
shutdown -s -c "Done with the Donuts" -t 60 -f

Should do it.

Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx]
[-c "c
omment"] [-d up:xx:yy]

No args Display this message (same as -?)
-i Display GUI interface, must be the first
option
-l Log off (cannot be used with -m option)
-s Shutdown the computer
-r Shutdown and restart the computer
-a Abort a system shutdown
-m \\computername Remote computer to shutdown/restart/abort
-t xx Set timeout for shutdown to xx seconds
-c "comment" Shutdown comment (maximum of 127 characters)
-f Forces running applications to close without
warning
-d [p]:xx:yy The reason code for the shutdown
u is the user code
p is a planned shutdown code
xx is the major reason code (positive
integer less than 256)
yy is the minor reason code (positive
integer less than 65536)
 
M

Morty McSnerd

If you put "Exit" on a single line in a batch file, .cmd or .bat, the batch
file will close and exit the window it is being run in.
 
T

Twayne

In
Eric said:
Does anyone have any suggestions on how to code a batch file to close
window? Thanks in advance for any suggestions
Eric

To end a program and thus close its window, use' taskkill' or 'tskill'. /?
in the Command Prompt will get you a list of switches as with all such
commands. One is a subset of the other.

To close down windows itself, use 'shutdown'. Again, 'shutdown /?' will
list the switches for you.

Those programs are all supplied with XP.

Twayne
 

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