1. What is the command prompt?
Command prompt is a program included with all versions of Windows which allows you to execute scripts (small programs) using a purely text-based interface.
Contrast this with the graphical user interface (buttons, mouse interactions) found in most programs you've previously used.
The command prompt reacts only to text based commands, and to some degree to mouse clicks. If you want something to work, you need to type it in and hit enter.
2. How do I access the command prompt?
You can access the command prompt (another term for command line) by navigating the Windows Start menu. It's usually under System or System Tools. You could also use the Run or Search menus to look for cmd.exe, which is the name of the actual command prompt program.
Access the Run menu with the Windows Key and the r key, then type cmd.exe and hit enter to bring up the command prompt.
If you want a version of the command prompt with a few more features, then you can use Powershell instead. It's found in it's own menu in the Windows 10 Start Menu.
3. How do I use the command prompt once I have it open?
As I said above, you type things into it (commands) and hit enter to execute those things.
Two useful commands that you should know are cd (change directory), and dir (view directory contents). If you're not familiar with the term, directory means essentially the same thing as folder in the context of Windows.
Type cd followed by the name of the folder you want to navigate to, then hit enter. For example:
If you want to view the contents of a folder, type dir followed by the name of the folder you want to inspect and then hit enter. For example:
If you don't want to type the full name, or are unsure of what constitutes a legal folder name, then type the command, and then hit tab to cycle through all legal inputs for that command in the current working folder.
Tab will autofill stuff like the folder names, required prefixes, and the backslash that indicates the end of a folder.
You can navigate through more than one folder at a time, by separating each folder in the path you want to navigate through with a backslash. For example:
Usually, cd and dir operate assuming that you're navigating from the folder you are currently in, which is found just before the part of the command prompt in which your typing appears. This is the full path to the current folder, starting from the name of the hard drive where you started. For example:
This is called the absolute path. At any time and in any location, you can navigate to an absolute path by typing it in full, starting with the name of the hard drive where it is found and going sequentially from there through each folder.
The command prompt always starts in the named drive where Windows operating system is installed, in this case:
If you want to navigate up a folder, enter .. after the command. For example:
You can navigate up multiple folders by separating each .. with a backslash. For example:
You can navigate both up and down multiple folders by combining .. and folder names. For example:
You can send the text output of a command (what it prints in the command prompt) to a text file with the redirection operator, which is the > character. For example:
dir C:\Users\Nitwit\Mods\FFT\gamefiles > fft_files_listing.txt
You can switch between any commands you've previously entered with the up and down arrows.
It is impossible to break anything with cd and dir, feel free to explore.
4. Why should I learn how to use the command prompt?
There are several reasons you should learn this.
- A lot of tools lack the graphical user interface (GUI) found in things like FFTPatcher, and can only be used with either the command prompt or through a batch file: a sort of script that can be made to run a command by clicking on it, among other things. Most coders don't make batch files. Many of these tools are very useful, and few people want to make a version with a GUI.
- Tools that can be run through the command prompt can be run through scripts in other programming languages, enhancing their usefulness and automating drudgery. For instance, CD Mage lacks the ability to import multiple files at once, so I wrote a python script that calls Cebix's psxinject program (https://github.com/cebix/psximager) to import hundreds of modified files into a disc image.
- Knowing how to use the command line makes it easier to learn how to do other coding and administration tasks, from file hashing to using a compiler. It's one of the first tasks that every novice programmer and hacker should learn how to do.
- Some tools with a GUI only produce error messages when called from the command line. Without an error message, you have fewer leads as to why a tool isn't working.
- If for some godforsaken reason you use Linux, you have no option but to use command line tools, scripts, and spreadsheets to make game editors.
- The command line accepts wildcards (also known as regular expressions if you want a deep dive on the subject), which can be a simple and easy to way automate boring tasks.
The new tool JuraviS also runs using command line commands! Nice write up
I had it lying around for my other projects requiring the command prompt, figured I'd post it here too.
Feel free to steal it.
While I agree it's a good post. It mostly serves to make me feel super old that this even needs to be said these days lol