Search code examples
powershellbatch-filecmdwindows-10powershell-5.0

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.


Solution

  • Test this as a diagnostic step.

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