1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Batch File Loops for Some Reason

Discussion in 'DOS/Other' started by Belfento, Apr 19, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. Belfento

    Belfento Thread Starter

    Joined:
    Apr 19, 2008
    Messages:
    9
    I wrote a batch file to shut down my computer, so I could use Scheduled Tasks to shut it down every day at 9:00 AM. The batch file is as follows:

    shutdown /s /f /t 30 /d p:1:1

    Every time I execute the batch file, it just loops endlessly, without actually executing the command. When I enter that command in the cmd window, it works just fine.

    Am I missing something?
     
  2. TheOutcaste

    TheOutcaste

    Joined:
    Aug 7, 2007
    Messages:
    9,028
    Not sure what you mean by "loops endlessly"
    Do you get the shutdown message and the 30 second countdown popup, then that repeats?
    Or, does the command prompt just fill with the shutdown command and you get no popup?
    Are you running the batch file from a command prompt, or double clicking the file on the desktop or from Windows Explorer?
    What OS - Win9x, Win2K, WinXP, Vista, ???
     
  3. Belfento

    Belfento Thread Starter

    Joined:
    Apr 19, 2008
    Messages:
    9

    It just fills the command prompt with the command, and I get no popup.
    I tried double-clicking the batch file, and running it from the command prompt, and I get the same result.
    I'm running Windows XP Home Edition.
     
  4. TheOutcaste

    TheOutcaste

    Joined:
    Aug 7, 2007
    Messages:
    9,028
    Did you by chance name the batch file shutdown.bat? If so, it is calling itself, not the shutdown.exe program.
    Name the batch file something else, or include the extension in the batch file:
    Code:
    shutdown.exe /s /f /t 30 /d p:1:1
     
  5. Belfento

    Belfento Thread Starter

    Joined:
    Apr 19, 2008
    Messages:
    9
    Yeah, that fixed it. Thank you.
     
  6. TheOutcaste

    TheOutcaste

    Joined:
    Aug 7, 2007
    Messages:
    9,028
    You're Welcome!

    If your issue has been resolved you (and ONLY you) can use the Thread Tools at the Upper Right (above the first post) to mark this thread Solved.:)
    [​IMG]
     
  7. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/705216