Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to create batch file to shutdown computer?

  1. Jan 14, 2016 #1
    Dear Group,

    I would like to ask a question regarding to the batch file,

    I am trying to create a batch file which could help to to shutdown to computer quickly, but when i run batch file, the command window showed up and keep running too many line but did not shut down the computer.

    But when I typed directly on the command line window, it worked.

    Please give me an advise, and this is a simple code and picture of the problem.
    @Echo off
    shutdown /s

    Thank you group,
    Best regards,
    Nate Duong.
     

    Attached Files:

  2. jcsd
  3. Jan 14, 2016 #2

    Filip Larsen

    User Avatar
    Gold Member

    If you name your batch file "shutdown.bat" (or "shutdown.cmd") and invoke it from its own directory (that is, the current working directory where the batch file is placed), then the batch file is not calling the windows shutdown.exe but your own batch file instead. If this is the case, then try rename your batch file to something else, or alternatively, provide a full path to the shutdown.exe.
     
  4. Jan 14, 2016 #3

    FactChecker

    User Avatar
    Science Advisor
    Gold Member

    The default wait time before the shutdown starts is 30 seconds. To make it start immediately, use /t 0. To make it force a shutdown without warning the user, use /f. So try "shutdown /s /f /t 0"

    You can see all the details by typing shutdown /? in a DOS command window.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: How to create batch file to shutdown computer?
Loading...