It's programming time!/Batch/Intro

From Create Your Own Story

< It's programming time! | Batch(Difference between revisions)
m (Let's Make A Batch File)
m
 
(4 intermediate revisions not shown)
Line 1: Line 1:
==Let's Make A Batch File==
==Let's Make A Batch File==
-
<div style="padding:20px background:0xEEEEEE">
+
<div style="background-color:rgb(245,245,245);">
A batch file is basically just a list of DOS commands. They can be used to automate a repetitive task or run any set of commands you might need on a regular basis. If you follow along you'll soon be able to create your own batch files to make your computing life easier.
A batch file is basically just a list of DOS commands. They can be used to automate a repetitive task or run any set of commands you might need on a regular basis. If you follow along you'll soon be able to create your own batch files to make your computing life easier.
-
You'll need:
+
</div>
-
A computer
+
<div style="padding:0px 20px;">You'll need:
-
A Windows (or DOS) operating system
+
<div style="padding:0px 20px;">
-
A text editor (such as notepad)
+
*A computer
 +
*A Windows (or DOS) operating system
 +
*A text editor (such as notepad)
 +
</div>
</div>
</div>
Line 20: Line 23:
''Remember: Don't edit the batch file while it's running. You can get unexpected errors that way.''
''Remember: Don't edit the batch file while it's running. You can get unexpected errors that way.''
-
[[It's_programming_time!/Batch/Echo|Tell me more about '''echo''']]<br>
+
*[[It's_programming_time!/Batch/Echo|Tell me more about '''echo''']]
-
[[It's_programming_time!/Batch/At_Symbol|Do all the lines have to start with '''@'''?]]<br>
+
*[[It's_programming_time!/Batch/At_Symbol|Do all the lines have to start with '''@'''?]]
-
[[It's_programming_time!/Batch/Pause|Why is there a pause?]]<br>
+
*[[It's_programming_time!/Batch/Pause|Why is there a pause?]]
-
[[It's_programming_time!/Batch/Dir|That's ''too'' simple, I want to learn something cooler.]]<br>
+
*[[It's_programming_time!/Batch/Dir|That's ''too'' simple, I want to learn something cooler.]]
 +
 
 +
[[Category:It's programming time!|Batch]]
 +
[[Category:It's programming time!/Batch|Intro]]

Current revision as of 02:29, 16 July 2016

Let's Make A Batch File

A batch file is basically just a list of DOS commands. They can be used to automate a repetitive task or run any set of commands you might need on a regular basis. If you follow along you'll soon be able to create your own batch files to make your computing life easier.

You'll need:
  • A computer
  • A Windows (or DOS) operating system
  • A text editor (such as notepad)

We'll start with the basics:

  1. Create a new text file. (Right click>>New>>Text Document)
  2. Rename your text file. Change the extension from .txt to .bat
  3. Open your .bat file in your text editor. You can drag and drop it into your editor from Windows.
  4. Add the following text to the file:
@echo The echo command repeats back whatever you type after it.
@pause
  1. Save your file without any formatting (Plain text).
  2. Double click your .bat file to execute the commands.

Remember: Don't edit the batch file while it's running. You can get unexpected errors that way.

Personal tools