We’re all used to using the mouse and nice user interfaces when working on a computer, but sometimes using a command line can be very useful! For instance, it’s the best way to encode videos and audio using the excellent FFmpeg, or using the command line renderer of After Effects. I’m going to explain here the basics of the command line on Windows. If you’re on Mac, click here (coming soon)!
Click on the images to see them at full size.
Opening a terminal
You can just press the windows button of your keyboard, type “cmd” and press return, or you can use the application called Windows PowerShell which is a bit more advanced, but still very similar to the standard command line.
Navigating, typing commands
To know where you are in the file system, just look at the beginning of the current line.
You can navigate in the file structure by typing the command
cd followed by a space and the name of the folder where you want to go.
As you can see in this example, typing
cd .. gets you to the parent folder. Note that to be quicker, you do not have to type the whole name of the folder where you want to go, you can only type the first letters and then press the Tab button, and the terminal will automatically complete the name. If there are several folders which names begin with the first letters you typed, you can cycle through all of them by pressing the Tab button again.
Spaces in the command line are used as a delimiter between commands or options. When you navigate to a folder which has spaces in its name, you have to write it between double quotes. But this is done automatically when pressing the Tab button!
You can display the list of the sub-folders and files in the current folder with the command
Using command line applications
To use a command line application, you either have to navigate to the executable file, or to type the whole path to it (which can be quick using the Tab button trick), and type its name.
Most of applications are launched with command line arguments or options, which are just other commands added after the executable file name and separated between spaces.
Simplifying the access to the executable files you often use.
Of course, it can be a pain to always have to navigate to the folder containing some applications, if you use them very often. Fortunately, it is easy on Windows to make the system “know” where they are so you do not have to type the whole path anymore. This is done using the Environment Variables of Windows, which are just simple options you can modify.
Just go to the system informations (through the configuration panel, or right-click on the This Computer icon on your desktop, then go into the Properties), and then open the advanced system parameters.
There, click on the Environment Variables button. In the dialog which opens, find the variable called Path in the user variables.
Now you just have to click on modify, then browse in the next window to add the path to the executable file of the application you want to use.
Once it’s done, you can open a new command line and now you just have to type the name of the executable file wherever you are to use the application!
That’s it for now! These are the very basics you’ll need to use tools like FFmpeg, but there are a lot more things you can do with the command line, like managing files (copy, move, remove…). You can even use it for batch processes with
.bat files. Use your favorite search engine to find out more 😉