Solved

Restarting a computer using a batch file

Posted on 2012-04-04
5
487 Views
Last Modified: 2012-04-04
I need  a batch file to restart a computer. It's a Win 7 box, so if there is a way in Win 7 to restart a machine on a schedule, then that would work just as well.

Else, I was planning on using Windows Task Scheduler to launch a .bat file.

As always, thanks in advance EE!

jpertchik
0
Comment
Question by:jpertchik
5 Comments
 
LVL 17

Expert Comment

by:Anuroopsundd
ID: 37807763
START C:\Windows\RUNDLL.EXE user.exe,exitwindowsexec
exit
0
 
LVL 17

Assisted Solution

by:Anuroopsundd
Anuroopsundd earned 250 total points
ID: 37807765
shutdown /r
0
 
LVL 22

Accepted Solution

by:
Christopher McKay earned 250 total points
ID: 37807766
you could use the shutdown command,

shutdown /r

this tells the system to shutdown and restart.

shutdown /g

this tells the system to restart, and then restart any registered applications,

shutdown /r /f

This tells the system to restart, and force any open applications to close.

Hope this helps!

:o)

Bartender_1
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 37807780
No batch file needed - from an elevated cmd prompt, type (or copy) the following:

schtasks /create /ru SYSTEM /sc daily /st 18:00 /tn Restart /tr "shutdown /r /f /t 0"
0
 

Author Closing Comment

by:jpertchik
ID: 37808028
Both had the right command.

Anuroopsundd's answer:
shutdown /r

Bartender_1's answer gave me the same command that I'll ultimately use, however he/she supplied more switches that might com in handy sometime.

you could use the shutdown command,

shutdown /r

this tells the system to shutdown and restart.

shutdown /g

this tells the system to restart, and then restart any registered applications,

shutdown /r /f

This tells the system to restart, and force any open applications to close.

Hope this helps!

:o)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question