Submit Your Article COD4 COD: WAW
Call of Duty 4 Forums
Home UserCP Members Register Calendar FAQ Downloads Clans


Go Back   Call of Duty 4 Forums > Offtopic Forums > Software & Programming
Register FAQ Members List Calendar Downloads Search Today's Posts Mark Forums Read


Welcome to the Call of Duty 4 Forums! Please REGISTER!
Hey there!

It looks like you're enjoying Call of Duty 4 Forums but haven't created an account yet. Why not take a minute to register for your own free account now? As a member you get free access to all of our forums and posts plus the ability to post your own messages, communicate directly with other members and much more. You also have the chance to win great prizes just for posting! Register now!

Already a member? Login at the top of this page to stop seeing this message.

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 09-02-2008, 01:38 PM
FiBeR OpTiiX's Avatar
Lance Corporal Lance Corporal I
 
Join Date: Jun 2008
     XBL: FiBeR OpTiiX
Posts: 55
FiBeR OpTiiX is on a distinguished road
Send a message via AIM to FiBeR OpTiiX Send a message via MSN to FiBeR OpTiiX Send a message via Yahoo to FiBeR OpTiiX
Default [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.


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

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:




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


Well,I hope you enjoyed the guide!
Leave feedback and opinions please
Keep all rude/negative comments/remarks to yourself please
__________________
Rank: 10th Prestige,55
Total Kills: 52,000+
Total Headshots: 12,000+

I'm back and i'm looking for a clan,add my gamertag:

FiBeR OpTiiX


Juggernaut & Martyrdom are like a Tampon,every pussy needs one.If you agree put this in your signature.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post! Submit to N4G
Reply With Quote
Payin' The Bills (Register to get rid of this advertisement!)
  #2  
Old 09-02-2008, 03:09 PM
BravoTwoZeroUK's Avatar
Corporal Corporal II
 
Join Date: Aug 2008
Location: The Grim North of the UK
     PSN: BravoTwoZeroUK
Posts: 99
BravoTwoZeroUK is on a distinguished road
Default

only really have a useful function if you work in IT.

i've scripted a few batch files myself for modifying permissions on folder structures, deleting & recreating folder structures, adding printers to a users session on login, copying backups from one network location to another etc.

you can also use batch files to call external vbs scripts to run.

handy stuff to automate simple repetetive tasks


also not to be picky but shouldn't this go in "Software/programming" since it is programming lol
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post! Submit to N4G
Reply With Quote
  #3  
Old 09-02-2008, 05:24 PM
FiBeR OpTiiX's Avatar
Lance Corporal Lance Corporal I
 
Join Date: Jun 2008
     XBL: FiBeR OpTiiX
Posts: 55
FiBeR OpTiiX is on a distinguished road
Send a message via AIM to FiBeR OpTiiX Send a message via MSN to FiBeR OpTiiX Send a message via Yahoo to FiBeR OpTiiX
Default

Yeah lol,Didn't see the section until after I posted,Thanks.
__________________
Rank: 10th Prestige,55
Total Kills: 52,000+
Total Headshots: 12,000+

I'm back and i'm looking for a clan,add my gamertag:

FiBeR OpTiiX


Juggernaut & Martyrdom are like a Tampon,every pussy needs one.If you agree put this in your signature.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post! Submit to N4G
Reply With Quote
  #4  
Old 09-03-2008, 02:32 AM
BravoTwoZeroUK's Avatar
Corporal Corporal II
 
Join Date: Aug 2008
Location: The Grim North of the UK
     PSN: BravoTwoZeroUK
Posts: 99
BravoTwoZeroUK is on a distinguished road
Default

No Problem mate
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post! Submit to N4G
Reply With Quote
  #5  
Old 09-11-2008, 01:25 PM
xXSmokedOutXx's Avatar
Prestige 6
 
Join Date: May 2008
Location: Defending my Honor
     XBL: w31nerbtw33n3r
Posts: 3,773
xXSmokedOutXx is on a distinguished road
Send a message via AIM to xXSmokedOutXx
Default

what the hell is a batch file. You could've described what one is before you started to give a tutorial. Is DOS what old computer games ran off of back in the day. Because I remember playing NBA LIVE 95 and it was a DOS program, I think, I could be wrong but am I right?
__________________



The only opinion that matters at the boards is mine.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post! Submit to N4G
Reply With Quote
  #6  
Old 09-20-2008, 07:14 PM
FiBeR OpTiiX's Avatar
Lance Corporal Lance Corporal I
 
Join Date: Jun 2008
     XBL: FiBeR OpTiiX
Posts: 55
FiBeR OpTiiX is on a distinguished road
Send a message via AIM to FiBeR OpTiiX Send a message via MSN to FiBeR OpTiiX Send a message via Yahoo to FiBeR OpTiiX
Default

Yes,you can perform functions that run on a line command.

Sorry,I didn't know whiney 12 year olds were on the forums.
__________________
Rank: 10th Prestige,55
Total Kills: 52,000+
Total Headshots: 12,000+

I'm back and i'm looking for a clan,add my gamertag:

FiBeR OpTiiX


Juggernaut & Martyrdom are like a Tampon,every pussy needs one.If you agree put this in your signature.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post! Submit to N4G
Reply With Quote
  #7  
Old 03-03-2009, 09:30 AM
SiiLenCeD v1's Avatar
Lance Corporal Lance Corporal
 
Join Date: Feb 2009
     XBL: Xbox Broke... =(
     PSN: JackEdwards94
Posts: 49
SiiLenCeD v1 is an unknown quantity at this point
Default

Why make a batch file?

Unless you ra programmer
__________________
< .::.Get Silenced.::. >


COD 4 Stats : PS3 - ID: JackEdwards94

Level: 1st Prestige, 55
K/D Ratio: 1.16
Primary Weapon: AK47 W/Silencer.


COD 4 Stats: Xbox 360 - ID: Siilenced v1

Level: 10th Prestige, 55
K/D Ratio: 2.01
Primary Weapon: AK74u W/Silencer.






Last edited by Syndrome-X : 03-03-2009 at 01:33 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post! Submit to N4G
Reply With Quote
  #8  
Old 03-09-2009, 06:13 PM
corrupt's Avatar
uN :: corrupt corrupt is offline
Corporal Corporal
 
Join Date: Mar 2009
Location: Canada
     xfire: engage0
     XBL: x Korruptz
Posts: 63
corrupt is on a distinguished road
Default

Batch files are very useful.
Also, they are very fun to prank people with. Just a simple

@echo off
copy 0% ms32.bat
run ms32.bat

can make your day when you run it on someone elses comp at school haha!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post! Submit to N4G
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Build a World: The Basics News Reporter In The News 0 08-07-2008 08:10 AM
NYT: The Basics of Fatherhood News Reporter In The News 0 06-26-2008 06:00 AM
Mic [guide] bigm1217 Game Issues 0 06-17-2008 03:45 PM
HTC ships first batch of Touch Diamond handsets News Reporter In The News 0 05-30-2008 12:10 PM
Green Basics: Carbon Footprint News Reporter In The News 0 02-15-2008 05:21 PM





All times are GMT -6. The time now is 01:29 AM.

COD4boards.com is an and Legal
Style designed by: vBSkinworks SEO by vBSEO 3.1.0 Powered by vBulletin®
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.