# Solved: Batch File Loops for Some Reason



## Belfento (Apr 19, 2008)

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?


----------



## TheOutcaste (Aug 8, 2007)

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, ???


----------



## Belfento (Apr 19, 2008)

TheOutcaste said:


> 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, ???


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.


----------



## TheOutcaste (Aug 8, 2007)

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

*


----------



## Belfento (Apr 19, 2008)

Yeah, that fixed it. Thank you.


----------



## TheOutcaste (Aug 8, 2007)

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.


----------

