Exactly one year ago in list of system commands on Microsoft's TechNet site., I promised to describe how to use commands to manage Windows. The earlier post linked to a comprehensive
The problem with the TechNet list is that it's a little too comprehensive. It's easy to lose the very useful ping, ipconfig, and tracert commands among the dozens of obscurities, such as atmadm, nbtstat, and unlodctr. You'll find a much more accessible list at Victor Laurie's site, which includes a page describing commands for renaming, deleting, backing up, and otherwise managing files.
For example, backing up your Documents (Vista) or My Documents (XP) folder to a USB thumb drive is as easy as typing a variation of either of the following lines:
xcopy C:\Users\username\Documents g:\backup /D /E /C /R /H /I /K /Y
xcopy "C:\Documents and Settings\username\My Documents" g:\backup /D /E /C /R /H /I /K
(Swap out "username" with your ID, and don't forget to put the quotes around the file path in XP.)
These examples assume you're using the default location of the folders. Change the drive letter to match that of your USB drive, or whatever device you're backing up the file to. At the end of each command are several switches:
The /D switch ensures that the files being copied are newer than the ones already on the destination device.
The /E switch will copy empty directories and subdirectories.
The /C switch ignores errors.
The /R switch copies over read-only files.
The /H switch copies hidden (system) files.
The /I switch creates directories on the destination device automatically.
The /K switch includes attributes to avoid making all the copied files read-only.
Lastly, the /Y switch gets rid of the prompts when overwriting files.
(My thanks to Victor Laurie's site for help with the switches.)
Open the command window in a flash
The fastest way to get to the command prompt is to create a keyboard shortcut that opens it. My original post covers the steps, but in Vista, you can open a command prompt by pressing the Windows key, typing cmd, and pressing Enter. In XP, click Start > Run, type cmd, and press Enter.
If you were computing in the good ol' DOS days, you may recall such commands as "cd" (to change the directory), "dir" (to view the files in the current directory), and "prn" (to print a file or files). Still, getting to know how to change directories, rearrange files, and perform other system tasks via commands can be a challenge. That's too much information to fit into one blog post.
Fortunately, Lawrence Abrams on Bleepingcomputer.com provides a nice Introduction to the Windows Command Line, even venturing into the area of batch files.
I guess I'll wait until next January 23 to cover batch files, though I'm probably going to need a bigger blog.