help with .bat file

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.

sort by: active | newest | oldest
1-10 of 24Next »
fretmelter (author) 9 years ago
SPAMMMMMMM
xuereb9 years ago
can anyone help me i have looked everywhere and i have not gotten an answer. The question is: How can you create a random integer between one number and another? Do you know? Plus could you have the second interger be a var Plz tell me if anyone has an answer i am working on a game right now so if you could help it would be great Plus i am kinda a noob i just started a little less that a week ago HELP
Padlock xuereb9 years ago
Go into command prompt, and type echo %random% . It will return a random value between 1 and 32767. With a little bit of script, you can make it return a value between 1 and X, but I'm not going to go into that since it is pretty easy.
on the shutdown, it won't work for me either, but on the delete thing, there's a parameter you can use(the yes parameter), it's /y or -y, but it does for any questions that come up
Demon-Dog10 years ago
hi, I am a batching noob and I would like to learn the basics to writing them as I find them very interesting and handy, there is a script I have been trying to write but I need some help, I want to write one where it shutsdown my PC after a selected time (preferred if it asked when I click) but if not I click it after editing the batch and it shouts down at that time. I hope somebody can help me do this and if possible teach me some other commands too. thanks, Demon-Dog.
. Write a batch file that invokes the shutdown command and set up a task to run the file in the Scheduled Tasks control panel. . AFAIK, there is no way for a batch file to accept mouse input.
mutant10 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."
LasVegas mutant10 years ago
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.
then why dont you just use a .bat to .exe converter?
mutant LasVegas10 years ago
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
exit
if "%choice%"=="yes"
pause
exit

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.
1-10 of 24Next »