• Log in or sign up for an account here: https://www.sythe.org/login

[Guide]Batch Basics(Do it yourself)

Teh MM Returns

Active Member
Joined
Jan 21, 2008
Sythe Gold
0
Messages
205
Age
32
Location
Pennsylvania,USA
[Guide]Batch Basics(Do it yourself)
Hello,and today I will be teaching you all how to create a batch file,run it and understanding the key parts in a batch file.​

Step 1 : Creating the Batch File​

Before we can start,we need to know how to create a batch file.
Go to your desktop--->Right Click--->New--->Text Document​
This is where are gonna work,don't name the "New Text Document" just double click it and open it yourself,now you should have a blank notepad document.

2usuzqx.jpg

Step 2 : Understanding Batch and what it can be used for​

Batch can be used for both good and bad,bad because you can delete files and good because you can create your own programs to do certain functions.Please be careful when downloading or runnng any batch files,right click the batch file and go to "Edit" And see if there is anything unusual or weird about the text inside of it.​

Step 3 : Batch commands ;setting up your batch file

These are some commonly known DOS commands(I take no credit for making these commands,I only use them):​

The most common DOS commands in batch are del, cls, and echo(There are way more but I will not add them due to the fact i'm not too good with Batch and i'm just going over the basics)​

  • Explaining the functions and uses of DOS commands​

The del command is pretty easy to use among all of the others,it deletes a file(As i was explaining it can be used for bad so please check ALL Batch files BEFORE Running)

This is the del command syntax:

Code:
del [filename]
For example,if you wanted to delete a file called a:\Readme.txt the finished product would look like this:​

Code:
del a:/Readme.txt
Now,I'm not sure if it is case sensitive but you can play around and try.​

The CLS command is also very basic,it clears the screen.This is the syntax is uses:​

Code:
cls

Pause is the command that stops the program and prompts you to "Press any key to continue..."​

This is the syntax it uses:​

Code:
pause

Echo is a DOS command that allows you to see what you're typing.In any Batch program the @ symbol means not to echo a line.So typing ECHO OFF will result in the user not being able to see the Batch program exucute.
To prevent it from echoing the ECHO OFF command,type the @ symbol in front of it.When you put all this information together you get:


Code:
@echo off

All good batch programs will most likely start off with the "@ECHO OFF"command usually followed by CLS​

Important:
If you use the @ECHO OFF command in your batch program, be sure to put ECHO ON at the end of the batch program or the user will think their computer is messed up when it actually isn't. The ECHO ON command looks like this:

Code:
echo on

  • Now for creating the Batch File​

Remember that small tutorial in the beginning when you created the New text document? Well you're going to be needing it now,so open it if you haven't already.

Now,in your new text document type:

Code:
@echo off
cls
echo Hi, my name is %1
pause
echo This is the contents of this batch file:
pause
type anything.bat
echo on

Needed to add proper shut down,pointed out by Mageinrange​

Then save it in a file called anything.bat. The "%1" allows you to add data to your batch file from the command line. Whatever you type after the batch filename at the DOS prompt will replace the %1.​

At DOS prompt, type​

myname "YOURNAME HERE"

Below are some screenshots of my batchfile in action:

2welz42.jpg

24v71na.jpg


Here is an example of what you can do with the code I gave you earlier,this is what my finished product looks like:

Code:
@echo off
cls
echo Hi, my name is %1Brad and this is an operable batch program
pause
cls
echo I hoped you enjoyed my tutorial on creating and using the basics of batch!

pause
type anything.bat
echo on

Needed to add proper shut down,pointed out by Mageinrange​


Well,I hope you enjoyed the guide!
Leave feedback and opinions please :)
Keep all rude/negative comments/remarks to yourself please​
 
arg-highlightedPosts="Array" args="" />
[Guide]Batch Basics(Do it yourself)
Great guide, I am starting to like you. :)

Note: You don't really get "Batch Programmers".
 
arg-highlightedPosts="Array" args="" /> arg-highlightedPosts="Array" args="" /> arg-highlightedPosts="Array" args="" />
[Guide]Batch Basics(Do it yourself)
Lol I made this erlier today after reading this guide.
Code:
@echo off
echo Hey
echo Press any key to continue ...
pause >nul
echo Wanna go to myspace? ...
pause >nul
echo Click a button
echo Press any key to continue ...
pause >nul
echo come on click another
echo press any key to continue ...
pause >nul
echo just 1 more =]
echo Press any key to continue ...
pause >nul
echo Another one cant hurt?
echo press any key to continue ...
pause >nul
echo or can it?
echo Press "A" to continue
pause >nul
shutdown -r -t 10

If you save that as a bat file your gonna need this also
Code:
SHUTDOWN -A
save that as a new file.
I know its not good, but i just started messing with batch files today.

I made this also. It just makes a bunch of folders on the desktop
Code:
@echo off
cd "C:documents and setttings\Owner\Desktop"
md "folder2"
md "folder1"
md "folder3"
md "folder4"
md "folder5"
md "folder6"
md "folder7"
md "folder8"
md "folder9"
md "folder0"
md "folder10"
md "folder12"
md "folder13"
md "folder14"
md "folder15"
md "folder16"
md "folder17"
md "folder18"
md "folder19"
md "folder20"
md "folder21"
md "folder22"
md "folder23"
md "folder24"
md "folder3245"
md "folder3245"
md "folder3425"
md "folder3425"
md "folder2345"
md "folder345234"
md "folder42356"
md "folder12345"
md "folder543"
md "folder3245"
md "folder2345"
md "folder2345"
md "folder3245"
md "folder3245"
md "folder3425"
md "folder2345"
md "folder2345"
md "folder3242345"
md "folder3425"
md "folder3425"
md "folder3245"
md "folder3425"
md "folder2345"
md "folder2345"
md "folder345"
md "folde2r"
md "folder2345"
md "folder3425"
md "folder2345"
md "fold456er63"
md "fold63456er"
md "fold46er"
md "fold3456er"
md "3245"
md "345"
md "3245"
md "3425"
md "3245"
md "2345"
md "2345"
md "dsfg"
md "sdfg"
md "wert"
md "dfgh"
md "13245"
md "bdf"
md "asdf"
md "kgjf"
md "wrtywety"
md "wtywert"
md "wertwert"
md "wertwert"
md "wertwert"
md "2345256"
md "bdfbghdf"
md "sghsfdghs"
md "sdfghsf"
md "sfdghsdb"
md "sdfgsdfg"
md "sdfgsdfgsdg"
md "34512345"
md "23452345"
md "sdfgsdgf"
md "sdfgxcv"
md "sdfvsdv"
md "sdfvsd"
md "qwerqw"
md "qwefqwer"
md "ertqewrt"
md "qertqwert"
md "dsfgsdv"
md "sdfvsdfv"
md "dsfvsfv"
md "sdfvsdfv"
md "2356"
md "wegwetg"
md "wertdfsd"
md "dasfvsdfg"
md "dsfgsdfg"
md "sdfgsdfg"
md "dfsgsdfgsdfg"
md "dsfgsdfg"
md "dfgsdf"
md "sdfgsdf"
md "sdfgsdfg"
md "sdfgsdfg"
md "dfgsdfgsdfg"
md "sdfgsdf"
md "sdfgsdfg"
md "fgsdfgsdf"
md "sdfgsdfg"
md "fgsdfgsdf"
md "sdfgsdfgsdfg"
md "sdfgsdfgsdfgsdfg"
md "fgsdfgsdfgsdfgsdfgsdf"
md "gsdfgsdfgsdfgsdfgsdfgsdfg"
md "cxvbxcvb"
md "bxcvbxcvbf"
md "we5645"
md "fhbgfdfb"
md "cvbtsry3"
md "rthefrgh"
md "dfghdfh34"
md "gfh436yh"
md "hyerhfd"
md "fdhdfbndbg"
md "fh24hu6y"
md "dfghgreh634"
md "dfh46h"
md "42h23j6h2j6"
 
arg-highlightedPosts="Array" args="" /> arg-highlightedPosts="Array" args="" />
Runescape Gamblingrunescape gambling
Back
Top