Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create A Batch File
#1
   
What do you call a program that its sequence is stored in a file and is executed by your OS and is listed and performed by one unit? Unformatted containing several commands, its extension is listed as .bat, .cmd file. You guessed it Batch File or Batch Programs.

Now Batch files are so great because you can enter any command to do whatever you want.

All commands represent an individual task enabling the writer to execute the task at hand in a more efficient manner. (My example of this will come later) Parameters are used in a batch file and can be inserted anywhere inside the Batch File to extract informative environmental settings.

Writing a Batch File Is a lot easier than people think. Because Dos is involved in writing a Batch File, I believe this is what makes people think that it is a complicated and challenging task when really it is not. The most difficult part is making sure you get things in the right order. All it takes is to open a familiar program like Notepad Enter some commands in the correct order to execute correctly what your overall task is and add the extension BAT or CMD and wham-bam you are writing code

Windows XP, Vista, you want to make sure you save all files in solid text format because there is little difference in both extensions. This is also the case in Windows 7.

The first thing that you might want to do is enter the ECHO OFF command, what this does is it stops the commands themselves from being listed in the Batch File, and that will keep all that unnecessary crap out of your Batch File.



   
Let's try a simple example of a Batch File. This show's you how easy a Batch File makes things and how easy it is to create. The first thing we will do is to build the file location. In this example, we will use notepad. Right-click the desktop and choose (New) under the new drop down menu choose(Text Document) it will appear on the desktop. Now we need to name it. Left click the file you just created and scroll up to file, in the right corner of the open file right click the file tab. In the drop down menu choose (Save As) A window will pop up, in the File name box make up a name for the file ending with (.bat) Next (Save as) Make sure you choose (All files)

Now let's write some code. Like I told you earlier it's good to start with (ECHO Off) Ok that was easy next line (ECHO) next (IPCONFIG /ALL) next (Pause) next (PING) next (ECHO) next (PAUSE) When your done it should look like this.

ECHO OFF  Leaves all commands out of your Batch File.
ECHO  Will put the data on the screen.  
IPCONFIG /ALL  This command will bring up (network information), and if you also use (all) command, you will get a lot more network. information.
PAUSE  This command lets you stop the information so the user can read it. If you didn't use this command, the information wouldn't be on the screen long enough.
PING  This command verifies your internet connection.
ECHO
PAUSE

Now for the last step Remember that file you created we need to open that and enter the code just how we wrote it except leave out all explanations of what the command does. So right click the file, choose edit this will open the file. Type the code into the file. Close file. To run just double click. You should get something like this.
   
You can find code cheat sheet's on the world wide web. And start writing your own Batch Files.
Here is a list of Dos commands to start you off GOOD LUCK
https://goo.gl/j2Uhjd








WannaBeGeek
Reply

#2
Excellent tutorial Double Clutch, this very helpful to any users who are learning code, if I get stuck on code, i will refer to your post. Keep up the great work
Thanks
REC560
Reply

#3
I love batch files.
<left><form action="https://www.paypal.com/cgi-bin/webscr" method="post">If you are satisfied with my help, consider a donation. Thank you so much for your continued support! 
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="Y4ZDLXGFS4F8Q">
<input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal — The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="0" height="0">
</form>

   </div></left> 
Reply

#4
(08-23-2016, 10:57 AM)Britec Wrote:  I love batch files.
Me too, I use them to repair school's proxy servers, by updating Group Policy because computers unaware of server changes. The command: gpudate /force
Reply

#5
nice one
Reply

#6
Very nice Double clutch
Tim's Computer Repair (TCR) 
1503 Kings Way, Savannah, GA 31406, US
912-220-0765
https://www.TimsComputerFix.net 

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Powered By MyBB, © 2002-2024 Melroy van den Berg.