Solved

Restarting a computer using a batch file

Posted on 2012-04-04
5
482 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
Comment Utility
START C:\Windows\RUNDLL.EXE user.exe,exitwindowsexec
exit
0
 
LVL 17

Assisted Solution

by:Anuroopsundd
Anuroopsundd earned 250 total points
Comment Utility
shutdown /r
0
 
LVL 22

Accepted Solution

by:
Bartender_1 earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Many admins will agree: WSUS is is a nice invention but using it on the client side when updating a newly installed computer is still time consuming as you have to do several reboots and furthermore, the procedure of installing updates, rebooting an…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now