Author Options:

help with .bat file Answered

ok i asked this in the "slightly more advance .bat file instructable" but i didnt know if anyone would notice it so i will ask it here. When i made my shut down.bat file i would start it and it would run it over and over agian and nothing would happen. Then when i type in command prompt it works. so then i try to do something else like the delete command in my .bat file. It worked but at first it didnt it would pop up and ask me if i wanted to delete it. But that may be becuz it was a directory not a single file. So then i checkd my spelling and everything but it was fine i cant figure out why it kept running it over and over.



11 years ago

for dialog or a comment use -c e.g. shutdown.exe -f -t 15 -c "All currently running applications will be forced to close in 15 seconds."

Again... This would only work if run from a batch file. The user want's this to appear during shutdown, not as a result of opening a batch file. If you look at his original attempt, your suggestion is exactly what he tried. Placing that in the shutdown folder results in an infinite loop. Try reading the entire thread before replying. This way you can avoid redundancy.

So wait... he wants a message to appear on regular shutdown? Like when he selects shutdown from the start button. Hmmm.... Well, I dont know about that. It seems kinda pointless. I mean, on regular shutdown you don't have enough time to save anything. And why would you want the computer to tell you that you just did something? Well you could make a file sorta like this.

@echo off
Echo Your computer is shutting down.
Echo Do you want to commence shutdown?
set choice=
set /p choice=
if "%choice%"=="no" shutdown -a
if "%choice%"=="yes"

Then you could add this to your registry so that it would load on shutdown. This would also give you the option to abort the shutdown.

If you had read the entire thread, you would have seen that this is not what he was after. Since I've already attempted to explain in my own word, I will leave it up to you to simply reread my replies.

  • Hint: He can't do it with a bat file...

11 years ago

Some computers do not accept the shutdown code. type shutdown.exe -f -t 15 instead.

This hasn't anything to do with the original intent. He wasn't looking for a batch command to shutdown the computer, but one to display a message prior to the shutdown. Ideally, he wanted to display an Alert Dialog that would display for a period of time or until dismissed with an button. While this isn't a difficult problem to solve, there is no simple batch command to do it.

lol yeah how do u do tht?

I have the same problem, whenever I try to use the shutdown bat it just repeats itself in command prompt. Is there any other way to make a shutdown command, other than the shutdown -s -f -t.... way?

hmmm ok what i really want to do is run a friends pc to give them a good scare without having to open command prompt but i guess i cant do it.

A good scare would be the Blue Screen of Death Screensaver.

ok shutdown -s -f -t 900 -c "put message here"

This would be fine (sort of) for a shut-down batch file to be executed by hand. The "message" would only appear momentarily as that feature is an old carry-over from DOS. You wouldn't want to put this in your Shutdown Items folder because it would, in effect, be calling itself each time the shutdown command was sent. It sounds like you want a batch file that will simply display a message, and exit when the user presses a key or the batch times out. Placing something like this in your shutdown items would probably work fine and wouldn't interfere with the shutdown process. Just don't use the shutdown command.

Also, can you make an instructable on your fm transmitter and USB charger? I make the USB Chargers, I just dont know where to get the FM Transmitter. I asked a couple question in your forum post about your fm transmitter and usb charger. THanks

My batch file is just a desktop icon on my desktop and here is the code: shutdown -f -t 15

Can you post the code for the shutdown.bat file. I have a shut Down batch file on my desktop, lets compare codes.