Writing a batch file

Discuss how to write good code, break bad code, your current pet projects, or the best way to approach novel problems

Writing a batch file

Post by hellow533 on Thu Jun 21, 2012 10:14 pm
([msg=67444]see Writing a batch file[/msg])

never mind I got it.




@echo off
color 6
echo Pentagon server system - what is your destination? (server/admin)
set /p input=
if %input%==server goto server
if %input%==admin goto admin
:server
echo Pentagon server system, please wait, your information is being recorded.
pause
cls
goto connected
:admin
echo Connecting to admin @ Pentagon server system- please wait, your information is being recorded.
pause
cls
goto connected
:connected
echo Connected to the admin pannel of the Pentagon server system- what would you like to do? (delete/explore)
set /p input=
if %input%==delete goto delete
if %input%==explore goto explore
pause
cls
:delete
echo systems are now being deleted, your information is being recorded for future refrences.
pause
cls
goto next
:next
echo The system will now shut down.
pause
cls
goto end
:explore
echo Where would you like to go? (files/quit)
set /p input=
if %input%==files goto files
if %input%==quit goto next
:files
echo Pentagon files are offline, your information has been recorded for future refrence.
pause
cls
echo error, system is deleting files.
pause
cls
goto delete
:end
“True hacking is like skydiving, you want to make sure you have arms, because nobody’s going to be there to pull the chute for you.”
User avatar
hellow533
Poster
Poster
 
Posts: 486
Joined: Thu Jan 29, 2009 3:27 pm
Blog: View Blog (0)


Re: Writing a batch file

Post by centip3de on Thu Jun 21, 2012 11:10 pm
([msg=67451]see Re: Writing a batch file[/msg])

hellow533 wrote:never mind I got it.




@echo off
color 6
echo Pentagon server system - what is your destination? (server/admin)
set /p input=
if %input%==server goto server
if %input%==admin goto admin
:server
echo Pentagon server system, please wait, your information is being recorded.
pause
cls
goto connected
:admin
echo Connecting to admin @ Pentagon server system- please wait, your information is being recorded.
pause
cls
goto connected
:connected
echo Connected to the admin pannel of the Pentagon server system- what would you like to do? (delete/explore)
set /p input=
if %input%==delete goto delete
if %input%==explore goto explore
pause
cls
:delete
echo systems are now being deleted, your information is being recorded for future refrences.
pause
cls
goto next
:next
echo The system will now shut down.
pause
cls
goto end
:explore
echo Where would you like to go? (files/quit)
set /p input=
if %input%==files goto files
if %input%==quit goto next
:files
echo Pentagon files are offline, your information has been recorded for future refrence.
pause
cls
echo error, system is deleting files.
pause
cls
goto delete
:end


For future reference, code tags would be appreciated. Also, some of your goto's are unnecessary, and just changing the order of the code would work.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rick Cook
User avatar
centip3de
Moderator
Moderator
 
Posts: 1410
Joined: Fri Aug 20, 2010 5:46 pm
Blog: View Blog (0)


Re: Writing a batch file

Post by hellow533 on Sat Jun 23, 2012 3:28 am
([msg=67480]see Re: Writing a batch file[/msg])

^was enough to make her think it was real, but thanks though.
“True hacking is like skydiving, you want to make sure you have arms, because nobody’s going to be there to pull the chute for you.”
User avatar
hellow533
Poster
Poster
 
Posts: 486
Joined: Thu Jan 29, 2009 3:27 pm
Blog: View Blog (0)



Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests

cron