5

Problem:

While running the batch file, it goes into infinite loop

Code:

shutdown -s -t 050

Output:

Ran the batch file enter image description here

Output when i run in normal batch file: enter image description here

Output when i run in admin batch file:

enter image description here

Question: Now I wonder why this happens, and want to know how to run shutdown command normally from batch file, if not like this ?

1 Answer 1

15

You called the batch file shutdown

Use a name that is not a system command or internal command.

3
  • 2
    Call it Shutdown50.bat for example.
    – foxidrive
    Sep 25, 2014 at 17:13
  • 5
    Other than changing the batch file name, you could also edit it to instead run shutdown.exe -s -t 050, since it's not an internal shell command.
    – Eryk Sun
    Sep 25, 2014 at 17:20
  • And here is detailed explanation this behavior: stackoverflow.com/a/38434127/5882271
    – kanlukasz
    Dec 3, 2020 at 18:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.