Windows 2000: Take command of CMD

Although Windows 2000 is a GUI-driven operating system, there are times when it's quicker and easier to fire up a character-mode CMD command interpreter (click Start-Run and type cmd in the dialogue box).

The CMD CLI (command line interface) in Windows 2000 is much cleverer than the DOS box of Windows 98/Me, but it's documented in an unexpected place; to see the detailed online help, type:

C:\cmd /?

This shows you the different switches and some of the settings options. Note that the CMD command interpreter isn't the same as the DOS COMMAND.COM interpreter; to load the latter, type command (followed by /? if you wish to see the switches you can pass to it).

The first thing you should do is to enable file and path name completion, as Windows 2000 uses long paths and file names. You can either start CMD with the /f:on switch (create a shortcut to CMD.EXE with that switch to save time), or enable it permanently in the Registry. For the latter, start Regedit and drill down to:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command ProcessorLook for these two REG_DWORD values, or create them if they don't exist:

CompletionChar

PathCompletionChar

The default hexadecimal values for the ASCII key codes are:

0x4 (Ctrl-D) for file name completion

0x6 (Ctrl-F) for path name completion

The CMD file and path name completion also supports the asterisk (*) wildcard. Typing:

C:\>cd win*

drops you in:

C:\windows>

WINDOW DRESSING

Next, let's snazz up the look of the CMD window a bit. Tweak the default small size and blocky font of the window by clicking on the little icon in the top left-hand corner and selecting Properties. Unfortunately, there are quite strict restrictions on "the fonts you can use for "CMD: it has to be a fixed-pitch, non-italic font (OEM_CHARSET), and if it's a TrueType one, it must be a Modern font face, which is monospaced and sans serif.

Adding fonts to the CMD console is a chore. Start Regedit, and go to:

HKLM\Software\Microsoft\Windows"NT\CurrentVersion\Console\TrueType"FontAdd a REG_SZ string value; you'll probably have the first font there, named "0", so call the next one "1" and as the data, enter the font name. No quotes anywhere, of course.

Then, set the window size under the Layout tab to a value that's right for your monitor resolution.

You can also set the Screen Buffer Size (i.e., the number of characters stored per line and the number of lines stored in the buffer) under the Layout tab, as well as the window position when you start up CMD.

The Options tab allows you to change the cursor size and the Command History buffer size; keep the QuickEdit (allows you to use the mouse to select text in the window) and Insert Modes (new text won't overwrite existing text). CMD is more useful in windowed than full-screen mode, so keep that default, too.

The Colors tab lets you change the colours of the CMD window.

PROMPT ME

Changing the prompt is easily done with the built-in "prompt" command.

Here's the list of prompt codes that you can use:

$A & (Ampersand).

$B | (pipe).

$C ( (Left parenthesis).

$D Current date.

$E Escape code (ASCII code 27).

$F ) (Right parenthesis).

$G > (greater-than sign).

$H Backspace (erases previous character).

$L < (less-than sign).

$N Current drive.

$P Current drive and path.

$Q = (equal sign).

$S (space).

$T Current time.

$V Windows XP version number.

$_ Carriage return and linefeed.

$$ $ (dollar sign).

For instance,

prompt $P$S$D$S$T$G

embellishes your prompt with the current drive and path, the date and time, as well as the > sign, separated by spaces.

The CMD interpreter recognises files with .bat, .com, .exe and .cmd as executables. It will also run the registered application for a file, if you type its name from the command prompt.

If you want further control over how a program should execute, use the built-in "start" command. This runs a specified program in a separate window, and you can set lots of options such as the execution priority, give 16-bit programs separate or shared memory space and more; you can even use start to open up Explorer windows, bypassing the directory name. nHotkeys for CMDUp and Down arrow keys - cycle through the command buffer.

[Function, or F keys]:

F1 - letter-by-letter recall of the last command.

F2 - copy the command line until specified character.

F3 - recall the last command.

F4 - delete the command line until specified character.

F6 - Ctrl-Z, or Windows End Of File character.

F7 - view the command buffer, and select from it.

F8 - cycle forwards through the command buffer.

F9 - recall a command from the buffer with its number.

Ctrl-C or Ctrl-BREAK - interrupt program execution.

Ctrl-G - system bell.

Ctrl-H - backspace.

Ctrl-I - cycle forwards through the command buffer.

Ctrl-S - suspend execution.

Ctrl-M - new line.

Ctrl-Z - end of file; write out contents of buffer and close file.

Ctrl-Shift-@ - More? prompt.

Join the newsletter!

Error: Please check your email address.
Rocket to Success - Your 10 Tips for Smarter ERP System Selection
Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Juha Saarinen

PC World
Show Comments

Cool Tech

SanDisk MicroSDXC™ for Nintendo® Switch™

Learn more >

Breitling Superocean Heritage Chronographe 44

Learn more >

Toys for Boys

Family Friendly

Panasonic 4K UHD Blu-Ray Player and Full HD Recorder with Netflix - UBT1GL-K

Learn more >

Stocking Stuffer

Razer DeathAdder Expert Ergonomic Gaming Mouse

Learn more >

Christmas Gift Guide

Click for more ›

Most Popular Reviews

Latest Articles

Resources

PCW Evaluation Team

Ben Ramsden

Sharp PN-40TC1 Huddle Board

Brainstorming, innovation, problem solving, and negotiation have all become much more productive and valuable if people can easily collaborate in real time with minimal friction.

Sarah Ieroianni

Brother QL-820NWB Professional Label Printer

The print quality also does not disappoint, it’s clear, bold, doesn’t smudge and the text is perfectly sized.

Ratchada Dunn

Sharp PN-40TC1 Huddle Board

The Huddle Board’s built in program; Sharp Touch Viewing software allows us to easily manipulate and edit our documents (jpegs and PDFs) all at the same time on the dashboard.

George Khoury

Sharp PN-40TC1 Huddle Board

The biggest perks for me would be that it comes with easy to use and comprehensive programs that make the collaboration process a whole lot more intuitive and organic

David Coyle

Brother PocketJet PJ-773 A4 Portable Thermal Printer

I rate the printer as a 5 out of 5 stars as it has been able to fit seamlessly into my busy and mobile lifestyle.

Kurt Hegetschweiler

Brother PocketJet PJ-773 A4 Portable Thermal Printer

It’s perfect for mobile workers. Just take it out — it’s small enough to sit anywhere — turn it on, load a sheet of paper, and start printing.

Featured Content

Product Launch Showcase

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?