Total Posts:5|Showing Posts:1-5
Jump to topic:

Shutdown batch file.

Fouler4990
Posts: 33
Add as Friend
Challenge to a Debate
Send a Message
2/5/2013 6:17:22 AM
Posted: 3 years ago
I have been learning about batch file lately and thought of making a 'shutdow batch file'. Here is the code, please see if the code is correct.
Note - Since DDO doesn't make it possible to type 'colons', I have given them as *colon*.
Code-

@echo off
title Shutdown bat file
echo.
Set /p a=Do you want to shutdown (y/n)?
If /i {%a%}=={y} goto:yes
If /i {%a%}=={n} goto:exit

*colon*yes
cls
echo.
echo Shutdown will commence...
pause>nul
shutdown -r -f -t3
exit

*colon*exit
exit
------------------------------------------
the well wisher of humanity
~ Fouler4990
AlwaysMoreThanYou
Posts: 2,900
Add as Friend
Challenge to a Debate
Send a Message
2/5/2013 7:42:37 AM
Posted: 3 years ago
At 2/5/2013 6:17:22 AM, Fouler4990 wrote:
I have been learning about batch file lately and thought of making a 'shutdow batch file'. Here is the code, please see if the code is correct.
Note - Since DDO doesn't make it possible to type 'colons', I have given them as *colon*.
Code-

@echo off
title Shutdown bat file
echo.
Set /p a=Do you want to shutdown (y/n)?
If /i {%a%}=={y} goto:yes
If /i {%a%}=={n} goto:exit

*colon*yes
cls
echo.
echo Shutdown will commence...
pause>nul
shutdown -r -f -t3
exit

*colon*exit
exit

I don't know why you'd pause after saying that shutdown will commence, especially a pause>nul so that no one even knows it's waiting for anything.

Of course if you're the only one who'll ever use this, that criticism is pointless.
'When the Spirit of truth comes, he will guide you into all the truth; for he will not speak on his own authority, but whatever he hears he will speak, and he will declare to you the things that are to come.' - John 16:13
Fouler4990
Posts: 33
Add as Friend
Challenge to a Debate
Send a Message
2/5/2013 8:34:31 AM
Posted: 3 years ago
At 2/5/2013 7:32:54 AM, drafterman wrote:
Have you tried running it?

Nop. Not yet. It's the first time I'm making a bat file, so, I thought of asking someone to check whether the codes are correct or not.
------------------------------------------
the well wisher of humanity
~ Fouler4990
Fouler4990
Posts: 33
Add as Friend
Challenge to a Debate
Send a Message
2/5/2013 8:41:06 AM
Posted: 3 years ago
At 2/5/2013 7:42:37 AM, AlwaysMoreThanYou wrote:

I don't know why you'd pause after saying that shutdown will commence, especially a pause>nul so that no one even knows it's waiting for anything.

Of course if you're the only one who'll ever use this, that criticism is pointless.

True... But on second thought, I think I'll remove that. After all, I have also kept 3 seconds after the shutdown comment. pause>nul will be pretty useless there.
------------------------------------------
the well wisher of humanity
~ Fouler4990