How To Restart Your Computer From The Command Line

Table of contents:

How To Restart Your Computer From The Command Line
How To Restart Your Computer From The Command Line

Video: How To Restart Your Computer From The Command Line

Video: How To Restart Your Computer From The Command Line
Video: How To Restart Your Computer using Command Prompt!! 2024, May
Anonim

There are cases that require restarting the computer without human intervention. Such an operation can be carried out using a command line tool, batch file, via remote access or in automatic mode. In this case, the usual combination of the menu "Start" -> "Shutdown", of course, is not applicable.

How to restart your computer from the command line
How to restart your computer from the command line

Instructions

Step 1

Click the "Start" button to bring up the main menu of the system and go to the "Run" item to invoke the command line tool.

Step 2

Enter the shutdown -t 0 -r -f command (where -r is restart, -f is to stop all running applications, -t 0 is to restart immediately, without a waiting period) in the Open field and click OK to execute the command (for Windows XP and Windows 7).

Step 3

Enter ping -n 0 127.0.0.1> nul & wmic OS WHERE Primary = "True" Call Win32Shutdown 6 in the Open field and press the function key Enter to confirm your choice (for Windows XP and Windows 7).

Step 4

Enter rundll32 user.exe, ExitWindowsExec 2 in the Open field and click OK to apply the selected changes (for Windows XP).

Step 5

Enter echo y | net stop eventlog in the Open field and press the Enter function key to confirm execution of the command (Windows XP up to and including SP2 only. This exits the event log service and automatically reboots the system. On newer systems this command does not work).

Step 6

Create and use a VBS script using the console command copy con filename.vbs:

set objWMIService = GetObject ("winmgmts:" & "{impersonationLevel = impersonate}! \. / root / cimv2")

set colSoftware = objWMIService. ExecQuery ("Select * from Win32_OperatingSystem")

for each objSoftware in colSoftware

objSoftware. Win32Shutdown 1

next

(for Windows XP and Windows 7).

Step 7

Enter psshutdown -r -f -t 0 -m in the Open field and click OK to confirm your choice.

Step 8

Create and use AutoIt script with any messages to restart the computer:

$ J = 30

ProgressOn

For $ i = 1 to 99 step 3.3

$ j = $ j-1

sleep (1000)

ProgressSet ($ i)

Next

ProgressSet (-1)

Shutdown (2)

sleep (5000).

Recommended: