Tuesday, 19 July, 2005

The Windows command line isn't totally lame

Microsoft seriously upgraded the Windows command line interface with Windows 2000.  Most users didn't notice, of course, because they never see the command line.  GUI is fine for most user tasks.  Those of us who actually use the command line mostly didn't notice because we'd been so thoroughly disgusted by the barely-functional Windows command line for so long and had our own ways of getting around its limitations.

For example, file and directory name completion has been available since at least Windows 2000.  Somebody at Microsoft, though, decided not to enable it by default.  But if you set the right environment variables, you can use the Tab key for command completion in much the same way as you can with the Linux command line.  Enter "cmd /?" at the Windows command line and scroll down a couple of pages to see how it's done.  Note that you can run a command shell and explicitly turn the feature on as described in Use File and Directory Name Completion in Command Prompt, or you can set the registry variables to enable the feature by default.  See Automatic DOS Completion in 2K for details.  It appears that command line completion is on by default in Windows XP and Windows 2003 Server.

Something else that I didn't know until recently is that they finally upgraded the DELETE command so that I can delete multiple files with a single command.  For example, prior to Windows 2000 if I wanted to delete two files I would have to issue two commands:

del file1
del file2

I never used NT 4, so I can't say when they changed this, but in Windows 2000 I can type a single command:

del file1 file2

It's been a long time since I sat down and explored the Windows command line.  The lesson to be learned here (yet again) is that you have to actively look for new and different things.  These and other enhancements have existed in Windows for at least five years, but since the command line acts just like it has for the last 25 years I didn't even think to check out the new functionality.  I guess it's time to give the Windows command line another look.