## Introduction to the Command Line

Prior to learning GDAL or scripting it is important to learn the Command Line and how to use commands from the command prompt.

### 6. Command line history

Sometimes you often use the same command. There are several tricks to type them more efficiently.

In your Windows Command Prompt Doskey is by default activated. Doskey is the tool that tracks the command line history. The emulator that we use has some limitations and some of the command below might not work. Remember that we had activated it in Chapter 2 of this tutorial.

Let's test if it remembered the commands we type from now.

1. Type the <F3> button.

This repeats the last command used.

2. Clear the command prompt and press the right arrow button several times. You can see that the characters of the previous command are repeated. If you press the up and down buttons, you can browse through the previously used command.

When you use <TAB> while typing a path or a filename, it will try to automatically complete it. This is very useful, because you avoid typos. In the emulator this doesn't work, but in your own Command Prompt you can use it, so don't type the complete file and directory names, but use tab completion.

With the doskey command we can do even more.

3. Type:
doskey /h <ENTER>

This prints all the commands you typed during this session to the screen.

If you close the command prompt, the command history will be lost.

4. Save the command history to a text file using one of the commands previously learned.

In this way you can edit the command history file in e.g. notepad. If you remove all the wrong commands and you save the file with the .bat extension, you can execute all of the commands in batch.

5. Try this for a few of the commands you have learned so far.

You can close a command prompt either by clicking on the cross in the corner, typing exit and pressing enter, or choosing Close when right clicking the Command Prompt icon on the task bar.

For the emulator you can simply close the browser(tab).