It's programming time!/Batch/Intro
From Create Your Own Story
(Difference between revisions)
(I've got some time to spare. Let's learn some basic batch commands.) |
m (→Let's Make A Batch File) |
||
Line 20: | Line 20: | ||
''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''']] | + | [[It's_programming_time!/Batch/Echo|Tell me more about '''echo''']]<br> |
- | [[It's_programming_time!/Batch/At_Symbol|Do all the lines have to start with '''@'''?]] | + | [[It's_programming_time!/Batch/At_Symbol|Do all the lines have to start with '''@'''?]]<br> |
- | [[It's_programming_time!/Batch/Pause|Why is there a pause?]] | + | [[It's_programming_time!/Batch/Pause|Why is there a pause?]]<br> |
- | [[It's_programming_time!/Batch/Dir|That's ''too'' simple, I want to learn something cooler.]] | + | [[It's_programming_time!/Batch/Dir|That's ''too'' simple, I want to learn something cooler.]]<br> |
Revision as of 01:15, 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:
- Create a new text file. (Right click>>New>>Text Document)
- Rename your text file. Change the extension from .txt to .bat
- Open your .bat file in your text editor. You can drag and drop it into your editor from Windows.
- Add the following text to the file:
@echo The echo command repeats back whatever you type after it. @pause
- Save your file without any formatting (Plain text).
- 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.
Tell me more about echo
Do all the lines have to start with @?
Why is there a pause?
That's too simple, I want to learn something cooler.