Teo Alivanoglou
Teo Alivanoglou

Reputation: 89

Shutdown /s /t xx doesn't work in my Windows 10 pc

As the title says, the typical shutdown /s /t xx command doesn't work when I run it from a script. Instead of shutting down after x seconds, it only runs the shutdown part, and ignores the arguments. However, if I type it manually in a Command Prompt window, it executes correctly. I tried running other commands from a script like ipconfig /all and I have no problems. Is this a general Windows 10 problem or did I mess up with something on my computer?

P.S. I get the same results with Powershell as well.

Upvotes: 1

Views: 23273

Answers (5)

bdwyer
bdwyer

Reputation: 1

Open notepad

Type in

shutdown /s /t 00

Save as shutdown.cmd to your desktop

Double click and this should work.

Upvotes: 0

user4317867
user4317867

Reputation: 2448

Might be worth mentioning Powershell doesn't always play nice with external executables and command line switches/arguments. Try using:

Start-Process shutdown.exe -ArgumentList "/s /t 20"

Also, there is Invoke-Item which can start a process but I've noticed using Start-Process

Reference this for more information.

Upvotes: 1

foxidrive
foxidrive

Reputation: 41244

Test this as a diagnostic step.

@echo off
"c:\Windows\System32\shutdown.exe" /s /t 20
pause

Upvotes: 9

briantist
briantist

Reputation: 47812

In PowerShell, you could use Stop-Computer.

Upvotes: 0

TheGentleman
TheGentleman

Reputation: 2362

Swap out our /s /t xx for -s -t xx. That fixed this on my Windows 10 system.

Upvotes: 3

Related Questions