![]() |
|
Batch tutorial [For begginers] - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Coding (https://sinister.li/Forum-Coding--71) +--- Thread: Batch tutorial [For begginers] (/Thread-Batch-tutorial-For-begginers) Pages:
1
2
|
Batch tutorial [For begginers] - JuiceKing - 07-08-2011 This tutorial is for beginners in batch coding... Happy reading! :thumbs:Let's start... ![]() to start off there is the @echo off/on and there is echo and pause so here is an example type this in notepad and save as test.bat launch it it will look like this: Code: Hello This is a test
Press any key to continue...Again open notepad and write: Code: @echo on
echo Hello This is a test
pauseand save it on the desktop as test2.bat launch it , it will look like this: So for the explanation @echo off/on: if you put @echo on it will show the directory as you just saw if you put @echo off it will just show the words with no directories so its best to use @echo off echo: If you want to type a simple phrase just type in echo and something in this case echo Hello This is a test which will show Hello This is a test pause pause will pause the batch file,if you press a key the batch will continue in this case it will exit because there is no more left so try this Code: @echo off
echo Hello This is a test
pause
echo I am testing pause
pauseThis will show Code: Hello This is a test
Press Any Key To Continue...
(when you press a key it will show)
I am testing a pause
Press Any key to continue..so that convers the pause command Now some more commands there is msg * and there is cls open notepad and write: and save as test3.bat This will show Code: Hello This is a test
Press Any Key To Continue...
(when you press a key it will show)
cls
(the page will clear)
I am testing a pause
(a pop-up will show saying The End)
Press Any key to continue..So .. cls will just clear the screen and msg * will bring up a pop-up ![]() other commands are REM and goto and start so create a folder name it Test put any picture inside and name it testpic open notepad and type @echo off echo Testing start and rem rem title Test start testpic.jpg (or any other extension) pause and save it inside the new folder as test4.bat launch it , it will show: so start will launch any file and rem is a remark.. which wont show in the bat file when running now the goto and set and if type this inside notepad Code: @echo off
echo This is a test
echo If you want to do math type 1 and press enter
echo If you want to see a picture type 2 and press enter
set /p option=
if '%option%'=='1' goto :math
if '%option%'=='2' start testpic.jpg (or any extension)
:math
echo 2+2
pauseand save it inside the new folder this will show Code: This is a test
If you want to do math type 1 and press enter
if you want to see a picture type 2 and press enter
(here you can type 1 or 2 and press enter)
(if you press 2 and Enter the picture will load)
(if you press 1 and enter this will show up):
2+2
Press any key to continue...so goto will go to a Label or a Part of the file when you put :Math a new label will be named Math and when you put goto :math the batch will go to :math set the set option will set something .. here its going to set :choice the set is , in some options followed by if so if I type 1 in this example the "choice" will be 1 .. and it will go to :math because we put if '%choice%'=='1' goto :math so if we put 1 the choice will be 1 therefore it will goto :math anyway those are the basics.. stay on crackhackforum.com and wait for more batch tutorials.. next time it will be more advanced Helloo!!!.. ..First go read my batches for n00bs tutorial.. it got the basics.. anyway.. let me starti am going to talk about call,exit,and SHIFT? go into notepad and type this and save in a new folder then open note pad and type this again Code: @echo off
echo I Love S*X
pauseand save in the same folder that you save the last one... and name it call.bat launch the first one this will show Code: yay me i know the basics of batch
I Love S*X
Press Any Key To Continue....
(when you press a key the below will appear)
Press Any Key To Continue...
and when you press a key it will exitok.. so now you know what exit does.. it exits the file Imao and call ,calls in another batch file!!.. so now for SHIFT which is a little hard so try to understand SHIFT [/n] If Command Extensions are enabled the SHIFT command supports the /n switch which tells the command to start shifting at the nth argument, where n euh.. can be between zero and eight. just like this 1 below SHIFT /2 would shift %3 to %2, %4 to %3, etc. and leave %0 and %1 ..euh.. how can i say it.. .:S.. unaffected yea thats the word . Examples the below has got to be saved as .bat.. so just name it test Code: @ECHO OFF
ECHO - %1
SHIFT
ECHO - %1After creating the above example test.bat file, if you were to type the below command at the MS-DOS prompt, it would print "- ONE" and then "- TWO"; this command is commonly used to work through each of the command extensions or remove command extensions. (SHIFT , i mean the explanation... i got it from a website and edited it) Ok I hope you understand ok thats it for now.. ill post a Batch Features Later Hello... please read the 2 tutorials before i will talk in this one about a lot of features here we go!.. first we will learn how to launch windows applications: type in notepad: This will show: Code: i am testing notepad
(and notepad will start minimized.. if you put /MAX instead of /MIN it will launch maximized)
Press Any Key To ContinueNow lets learn how to put a timeout inside a batch.. goto notepad and type: Code: @echo off
echo i am trying timeout
set wait=0
:pause1
set /a wait=%wait%+1
if %wait% leq 1000 goto pause1
echo IT WORKED!\
pausedont understand the command.. just copy paste it.. or memorize it .. if i tell you the explanation it will take years!!.. so this will show : Now ill teach you how to change the TIME goto notepad and type: Code: @echo off
echo Gee!.. i wonder what time it is!!
TIME 5:50
echo Oh so its 5:50
pausethis will show: Code: Gee!.. i wonder what time its is!!
Oh so its 5:50The TIME will just change The TIME ImaoNow the Color go into notepad and type this 04=background black and font red f the font will be white 4f = background red and f = white Here are the list(that can be found by cmd>color help) 0=black 1=blue 2=green 3=aqua 4=red 5=purple 6=yellow 7=white 8=gray 9=light blue a=light green b=light aqua c=light red d=light purple e=light yellow f=bright white So this will show Imao i wont tell try it!! now the title type this in notepad: Code: @echo off
tile Test
echo trying the title
pausethis will show the title Test When you launch it!! lets try Shutdown/Restart type this in Notepad: Code: @echo off
START C:\Windows\RUNDLL.EXE user.exe,exitwindowsexec
exitThe above will restart The Above will Shutdown. Now try to code some batch virus.. Good luck! :thumbs:P.S. If u need some code find it on Google!Remember "Google is hacker best friend!"
RE: Batch tutorial [For begginers] - Vampex0 - 07-08-2011 Great contribution, thanks for the share bro. RE: Batch tutorial [For begginers] - JuiceKing - 07-09-2011 (07-08-2011, 11:57 AM)virtual000 Wrote: yup ....... Nice... ![]() (07-08-2011, 03:44 PM)Vampex0 Wrote: Great contribution, thanks for the share bro. You're welcome...
RE: Batch tutorial [For begginers] - chipp - 07-30-2011 nice bro... i like the tutorial... btw, can you fix the post that missing? like this: Quote:go into notepad and type this RE: Batch tutorial [For begginers] - JuiceKing - 07-30-2011 (07-30-2011, 10:00 AM)chipp Wrote: nice bro... i like the tutorial... btw, can you fix the post that missing? like this: Yeah i can fix it... RE: Batch tutorial [For begginers] - Diabolic666 - 11-21-2011 Very good tutorial :ok: Just didn't get how the "msg *" works
RE: Batch tutorial [For begginers] - ArkPhaze - 11-27-2011 (11-21-2011, 02:59 PM)Diabolic666 Wrote: Very good tutorial :ok: The * is a wildcard in batch, so that is a message to all computers on the network for example, otherwise you would have to put in the local IP address for which computer on the network you want to msg. Example: Code: msg 192.0.0.5RE: Batch tutorial [For begginers] - Diabolic666 - 11-27-2011 (11-27-2011, 02:42 AM)Infinity Wrote:(11-21-2011, 02:59 PM)Diabolic666 Wrote: Very good tutorial :ok: And how do you define what the message is? RE: Batch tutorial [For begginers] - ArkPhaze - 11-27-2011 (11-27-2011, 06:10 AM)Diabolic666 Wrote:(11-27-2011, 02:42 AM)Infinity Wrote:(11-21-2011, 02:59 PM)Diabolic666 Wrote: Very good tutorial :ok: It will prompt you for an input RE: Batch tutorial [For begginers] - Diabolic666 - 11-27-2011 (11-27-2011, 06:11 AM)Infinity Wrote:(11-27-2011, 06:10 AM)Diabolic666 Wrote:(11-27-2011, 02:42 AM)Infinity Wrote:(11-21-2011, 02:59 PM)Diabolic666 Wrote: Very good tutorial :ok: Got it now, thanks
|