Solved shutdown /r in a batch script


shoober420

Well-known member
Member
VIP
Local time
9:34 PM
Posts
231
OS
Windows 11 27965
when i put
Code:
shutdown /r
in a batch script, it spams the command in the terminal when opened but doesnt reboot the machine. why does this command behave this way in a batch script?
 
Windows Build/Version
Windows 11 27954

My Computer My Computer

At a glance

Windows 11 27965Intel i7 7700 @4.0ghz64gb DDR4Radeon RX 5500 XT
OS
Windows 11 27965
Computer type
PC/Desktop
CPU
Intel i7 7700 @4.0ghz
Memory
64gb DDR4
Graphics Card(s)
Radeon RX 5500 XT
Sound Card
Topping D50s
Hard Drives
NVMe
PSU
Corsair
Keyboard
Stelseries G6v2
Mouse
Zowie EC2
Other Info
https://www.youtube.com/shoober420
"shutdown /r /f /t 0" or "/t 10"
 

My Computer My Computer

At a glance

Windows 7
OS
Windows 7
I agree with garlin.

My own shutdown is a shortcut rather than a batch file but works in the same way:-
shutdown.exe /r /t 0 /f /c "Restart in Menus"

There's guidance in Shutdown - SS64

I use the /c switch so that I can see my deliberate shutdowns in Event viewer.
It doesn't make very much difference but I think I'll appreciate knowing which entries were deliberate if I ever have to investigate shutdown-related problems.
[Log - System, Source - User32, EventID 1074]
Shutdown comment.webp



All the best,
Denis
 

My Computer My Computer

At a glance

Windows 11 Home x64 Version 25H2 Build 26200....
OS
Windows 11 Home x64 Version 25H2 Build 26200.9168
i had to add .exe at the end of shutdown for the batch script to launch properly (shutdown.exe /s)
 

My Computer My Computer

At a glance

Windows 11 27965Intel i7 7700 @4.0ghz64gb DDR4Radeon RX 5500 XT
OS
Windows 11 27965
Computer type
PC/Desktop
CPU
Intel i7 7700 @4.0ghz
Memory
64gb DDR4
Graphics Card(s)
Radeon RX 5500 XT
Sound Card
Topping D50s
Hard Drives
NVMe
PSU
Corsair
Keyboard
Stelseries G6v2
Mouse
Zowie EC2
Other Info
https://www.youtube.com/shoober420
i had to add .exe at the end of shutdown for the batch script to launch properly (shutdown.exe /s)
I've seen that before.

Please run this in a cmd window
echo %pathext%
or this in a PS window
Get-ChildItem Env:pathext
You should get the response
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC


Denis
 
Last edited:

My Computer My Computer

At a glance

Windows 11 Home x64 Version 25H2 Build 26200....
OS
Windows 11 Home x64 Version 25H2 Build 26200.9168
Also, you can do "where shutdown" to confirm there isn't another "shutdown" in your %PATH% that gets called.
 

My Computer My Computer

At a glance

Windows 7
OS
Windows 7

Latest Support Threads

Back
Top Bottom