My first Batch program (simple program/link shortcuts) - SIM-1400293 - Aug 10, 2012
Hey guys,
I know it's nothing impressive and a lot of the beginner stuff being re-used, but it does whatever I wanted to achieve with it.
Here's the code:
Code @echo off
title Computer Manager
color 0a
echo Welcome back my Master.
ping localhost -n 3 >null
cls
:start
cls
echo What would you like to do today?
echo.
echo For opening websites, press A
echo For opening programs, press B
echo For terminating the program, press C
set /p FirstValue=
if %FirstValue% == A goto a
if %FirstValue% == B goto b
if %FirstValue% == C goto c
:a
cls
echo You chose to open one of the following websites.
echo.
echo Press the number listed before the site to open it.
echo.
echo 1) HackForums
echo 2) Facebook
echo 3) Youtube
echo 4) Paypal
echo 5) Hotmail
echo Type Back to go back to start.
set /p SecondValue=
if %SecondValue% == 1 goto HackForums
if %SecondValue% == 2 goto Facebook
if %SecondValue% == 3 goto Youtube
if %SecondValue% == 4 goto Paypal
if %SecondValue% == 5 goto Hotmail
if %SecondValue% == Back goto start
:HackForums
echo You chose to open HackForums, please wait.
ping localhost -n 2 >null
cls
echo Opening Browser.
ping localhost -n 2 >null
cls
echo Opening Browser..
ping localhost -n 2 >null
cls
echo Opening Browser...
ping localhost -n 2 >null
cls
Start C:\Users\Tom\Desktop\Opera.lnk https://hackforums.net
echo Finished main task.
echo Do you want to execute another task?
set /p ThirdValue=
if %ThirdValue% == yes goto start
if %ThirdValue% == Yes goto start
if %ThirdValue% == no goto c
if %ThirdValue% == No goto c
:Facebook
echo You chose to open Facebook, please wait.
ping localhost -n 2 >null
cls
echo Opening Browser.
ping localhost -n 2 >null
cls
echo Opening Browser..
ping localhost -n 2 >null
cls
echo Opening Browser...
ping localhost -n 2 >null
cls
Start C:\Users\Tom\Desktop\Opera.lnk http://facebook.com
echo Finished main task.
echo Do you want to execute another task?
set /p ThirdValue=
if %ThirdValue% == yes goto start
if %ThirdValue% == Yes goto start
if %ThirdValue% == no goto c
if %ThirdValue% == No goto c
:Youtube
echo You chose to open Youtbe, please wait.
ping localhost -n 2 >null
cls
echo Opening Browser.
ping localhost -n 2 >null
cls
echo Opening Browser..
ping localhost -n 2 >null
cls
echo Opening Browser...
ping localhost -n 2 >null
cls
Start C:\Users\Tom\Desktop\Opera.lnk http://youtube.com
echo Finished main task.
echo Do you want to execute another task?
set /p ThirdValue=
if %ThirdValue% == yes goto start
if %ThirdValue% == Yeses goto start
if %ThirdValue% == no goto c
if %ThirdValue% == No goto c
:Paypal
echo You chose to open Paypal, please wait.
ping localhost -n 2 >null
cls
echo Opening Browser.
ping localhost -n 2 >null
cls
echo Opening Browser..
ping localhost -n 2 >null
cls
echo Opening Browser...
ping localhost -n 2 >null
cls
Start C:\Users\Tom\Desktop\firefox.lnk http://paypal.com/home
echo Finished main task.
echo Do you want to execute another task?
set /p ThirdValue=
if %ThirdValue% == yes goto start
if %ThirdValue% == Yes goto start
if %ThirdValue% == no goto c
if %ThirdValue% == No goto c
:Hotmail
echo You chose to open Hotmail, please wait.
ping localhost -n 2 >null
cls
echo Opening Browser.
ping localhost -n 2 >null
cls
echo Opening Browser..
ping localhost -n 2 >null
cls
echo Opening Browser...
ping localhost -n 2 >null
cls
Start C:\Users\Tom\Desktop\Opera.lnk http://hotmail.com
echo Finished main task.
echo Do you want to execute another task?
set /p ThirdValue=
if %ThirdValue% == yes goto start
if %ThirdValue% == Yes goto start
if %ThirdValue% == no goto c
if %ThirdValue% == No goto c
:b
cls
echo You chose to open one of the following programs.
echo.
echo Press the number listed before the program to open it.
echo.
echo 5) iTunes
echo 6) Opera
echo 7) Firefox
echo 8) Steam
echo 9) Go back to start
set /p FourthValue=
if %FourthValue% == 5 goto itunes
if %FourthValue% == 6 goto opera
if %FourthValue% == 7 goto firefox
if %FourthValue% == 8 goto Steam
if %FourthValue% == 9 goto start
:itunes
cls
echo You chose to start iTunes, please wait.
echo Starting program.
ping localhost -n 2 >null
cls
echo Starting program..
ping localhost -n 2 >null
cls
echo Starting Program...
start C:\Users\Tom\Desktop\itunes.lnk
echo Main task completed, would you like to execute another task?
set /p FifthValue=
if %FifthValue% == yes goto start
if %FifthValue% == Yes goto start
if %FifthValue% == no goto c
if %FifthValue% == No goto c
:opera
cls
echo You chose to start Opera, please wait.
echo Starting program.
ping localhost -n 2 >null
cls
echo Starting program..
ping localhost -n 2 >null
cls
echo Starting Program...
start C:\Users\Tom\Desktop\opera.lnk
echo Main task completed, would you like to execute another task?
set /p FifthValue=
if %FifthValue% == Yes goto start
if %FifthValue% == yes goto start
if %FifthValue% == no goto c
if %FifthValue% == No goto c
:firefox
cls
echo You chose to start Firefox, please wait.
echo Starting program.
ping localhost -n 2 >null
cls
echo Starting program..
ping localhost -n 2 >null
cls
echo Starting Program...
start C:\Users\Tom\Desktop\firefox.lnk
echo Main task completed, would you like to execute another task?
set /p FifthValue=
if %FifthValue% == yes goto start
if %FifthValue% == Yeses goto start
if %FifthValue% == no goto c
if %FifthValue% == No goto c
:steam
cls
echo You chose to start Steam, please wait.
echo Starting program.
ping localhost -n 2 >null
cls
echo Starting program..
ping localhost -n 2 >null
cls
echo Starting Program...
start C:\Users\Tom\Desktop\Steam.lnk
echo Main task completed, would you like to execute another task?
set /p FifthValue=
if %FifthValue% == yes goto start
if %FifthValue% == Yes goto start
if %FifthValue% == no goto c
if %FifthValue% == No goto c
:c
cls
echo You chose to terminate the program, are you sure?
echo Type Yes to terminate, type No to go back to start.
set /p kill=
if %kill% == Yes goto kill
if %kill% == No goto start
:kill
cls
echo Terminating program.
ping localhost -n 2 >null
cls
echo Terminating program..
ping localhost -n 2 >null
cls
echo Terminating program...
ping localhost -n 2 >null
cls
echo Byebye!
ping localhost -n 2 >null
exit
Also, I was wondering... Is there a way to make a batch program send emails?
* - Five Finger Death Punch - Aug 10, 2012
I think you should add google to the list of websites to go to.
* - Dat Ting - Aug 10, 2012
not bad, not bad at all. keep up the good work man.
* - RichPrince100 - Aug 10, 2012
Ok when I first started coding batch was the first one i learn't even back in the day it was called a scriptkiddies lang and you got no respect for posting it even if it was the bee's knees...
ok so first add some goto commands something like this
@echo off
title hello
:start
echo hello
ping localhost -n 3 >null
echo
goto start
then add some kind of feature which counts how many times this has happend and pulls it out of the loop just give it a shot thats how i learn't
hope i helped listen
* - SIM-1400293 - Aug 10, 2012
Thanks for the feedback guys, I really do appreciate it!
* - Hidden™ - Aug 10, 2012
It is a nice first program, good work.
* - blatant lie - Aug 10, 2012
guys, what does the cls do? im still a skiddie
* - CMOSDeaD - Aug 10, 2012
(Aug 10, 2012 12:52 PM)iiTom Wrote: "Start C:\Users\Tom\Desktop\Opera.lnk http://youtube.com"
If someone were to use this one thing is that I don't think everyone's name is Tom.
(Aug 10, 2012 05:35 PM)blatant lie Wrote: guys, what does the cls do? im still a skiddie cls means Clear screen which basically... Clears screen.
* - THUG x WRECK - Aug 10, 2012
For:
Code Start C:\Users\Tom\Desktop\Opera.lnk http://youtube.com
Use:
Code Start opera http://youtube.com
* - SIM-1400293 - Aug 11, 2012
(Aug 10, 2012 08:59 PM)CMOSDeaD Wrote: If someone were to use this one thing is that I don't think everyone's name is Tom.
cls means Clear screen which basically... Clears screen.
Of course not, I never posted it for it to work for others :)
And tbh, anyone who knows a little about batch could fix that to work for him/her :)
* - Dan4655 - Sep 1, 2012
Hey man nice first batch file its alot of beginner stuff but atleast it was way better than my first bat file :D
|