Starting a command prompt
There are several ways to start a command prompt:
The first thing you'll notice about the command prompt is that it lists the current directory (by default this is set to your user directory), followed by a ">". This is the prompt. It is prompting you to type something.
If you decide to create your own shortcut on your desktop or taskbar, you can customize it to make things easier for yourself. To get to the customization dialog, right click on the shortcut and select "Properties"
- Shortcut Tab: You'll probably want to create a source directory somewhere on your hard drive where you're going to do all your development. It's best to make it someplace that's easily accessible (ex: "C:\mycode"). Set the "Start In" value to point to this folder. Whenever you click on the shortcut to start a command prompt, it will start in this directory.
- Options Tab: I suggest turning on "QuickEdit mode" and "Insert mode". This will allow you to copy and paste text from and into the command prompt with the right mouse button.
- Layout Tab: I always change the window width and height to something bigger than the default. Otherwise reading error messages can be more difficult
Making it easier
Typing out long directory names can be painful, especially if you're a beginning typist. To make things easier you can use auto-completion. With auto-completion, you simply type the first part of a file name or directory and then press the "Tab" key. The first filename or directory that matches that prefix will then be completed for you on the command line (automatically adding quotes if necessary). To use auto-completion, download
and open / run this script. Here's an example of something you can try:
> cd c:\
> cd doc
If there are multiple files or directories with the prefix you are using, pressing
multiple times will cycle through the available options.
Even with auto-completion, it's still a pain to have to type out the full path name to cedit every time we want to create a new file. We can make it much easier by putting cedit "in the PATH". The PATH is an environment variable that Windows* looks at every time you tell it to run a program without a full path name. It is a list of directories separated by the ";" character. Adding a directory to your PATH is similar to what you do with the environment variables in the Prototype setup
, except that instead of replacing the variable value, you append it to the end. Make sure that when you add a directory to the end of the PATH that you add a semi-colon to separate it from the previous ones. So to make using the Crimson Editor easier, add it's installation directory to your PATH. Here's what my PATH looks like: "C:\bin;C:\Vim\vim61;C:\ant\bin;C:\Program Files\WinZip;%JAVA_HOME%\bin;C:\WiX;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Crimson Editor" Now if you open a new command prompt, all you have to do is type
> cedit filename.java
to create a new file.
||Old command prompts lying around
||This will not work for command prompts that were started before you changed your PATH. You will have to close any open command prompts and restart them.
Note: The "%JAVA_HOME%" in my PATH is another environment variable. It's value is set to the directory where my Java is installed. The same should work for you if you set up JAVA_HOME according to the Prototype setup
, but you can also just type out the full directory. Do this now as it will help greatly when we start compiling code and running programs (below).