PC Review


Reply
Thread Tools Rate Thread

How to code a batch file to close window?

 
 
Eric
Guest
Posts: n/a
 
      20th Dec 2009
Does anyone have any suggestions on how to code a batch file to close window?
Thanks in advance for any suggestions
Eric
 
Reply With Quote
 
 
 
 
Shenan Stanley
Guest
Posts: n/a
 
      20th Dec 2009
Eric wrote:
> 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?

--
Shenan Stanley
MS-MVP
--
How To Ask Questions The Smart Way
http://www.catb.org/~esr/faqs/smart-questions.html


 
Reply With Quote
 
Eric
Guest
Posts: n/a
 
      20th Dec 2009
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

"Shenan Stanley" wrote:

> Eric wrote:
> > 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?
>
> --
> Shenan Stanley
> MS-MVP
> --
> How To Ask Questions The Smart Way
> http://www.catb.org/~esr/faqs/smart-questions.html
>
>
> .
>

 
Reply With Quote
 
Shenan Stanley
Guest
Posts: n/a
 
      20th Dec 2009
Eric wrote:
> 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.

--
Shenan Stanley
MS-MVP
--
How To Ask Questions The Smart Way
http://www.catb.org/~esr/faqs/smart-questions.html


 
Reply With Quote
 
Daave
Guest
Posts: n/a
 
      20th Dec 2009
Eric wrote:
> 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.)


 
Reply With Quote
 
Bob CP
Guest
Posts: n/a
 
      20th Dec 2009
Eric wrote:
> 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
>
> "Shenan Stanley" wrote:
>

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

Add
shutdown -s
as the last line in your batch file.
 
Reply With Quote
 
Shenan Stanley
Guest
Posts: n/a
 
      20th Dec 2009
Eric wrote:
> Does anyone have any suggestions on how to code a batch file to
> close window? Thanks in advance for any suggestions


Shenan Stanley wrote:
> 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?


Eric wrote:
> 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 Stanley wrote:
> 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 [u][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)

--
Shenan Stanley
MS-MVP
--
How To Ask Questions The Smart Way
http://www.catb.org/~esr/faqs/smart-questions.html


 
Reply With Quote
 
Morty McSnerd
Guest
Posts: n/a
 
      20th Dec 2009
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.


"Eric" <(E-Mail Removed)> wrote in message
news:70F1A39B-F38B-46A7-BD13-(E-Mail Removed)...
> Does anyone have any suggestions on how to code a batch file to close
> window?
> Thanks in advance for any suggestions
> Eric



 
Reply With Quote
 
Twayne
Guest
Posts: n/a
 
      21st Dec 2009
In news:70F1A39B-F38B-46A7-BD13-(E-Mail Removed),
Eric <(E-Mail Removed)> typed:
> 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
--
--
Live in the moment;
be open to the possibilities
that life has to offer.

 
Reply With Quote
 
Eric
Guest
Posts: n/a
 
      21st Dec 2009
Thank everyone very much for suggestions
Eric

"Bob CP" wrote:

> Eric wrote:
> > 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
> >
> > "Shenan Stanley" wrote:
> >

> http://www.computerhope.com/shutdown.htm
>
> Add
> shutdown -s
> as the last line in your batch file.
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Batch file to close a window GTS Windows Vista File Management 0 30th May 2009 03:23 PM
Save batch window msgs to a file from the batch prog Stephen Rainey Windows XP General 3 10th Jan 2007 12:50 AM
How to close Outlook from a batch file Jerry Microsoft Windows 2000 1 6th Nov 2003 08:21 PM
Re: Force Batch file DOS Window to close LiquidJ Microsoft Windows 2000 Developer 0 28th Oct 2003 09:41 PM
Force close batch file DOS window Orlando Calderon Microsoft Windows 2000 CMD Promt 1 28th Oct 2003 06:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:13 PM.