Download software, read reviews, get tips and support.  
Home   Articles   Forum   Reviews   Downloads   About/Contact

  PC-Net's PC News
 
Don Watkins

Take Command of the Command Prompt - Take Command of the Command Prompt - The Command Prompt. What It Is and How To Use It. Part 2

By Don Watkins

 
 
 

 

Last month’s article started you off on your trip down the command line complete with a path. Ouch, sorry for the bad pun on the path command but if you haven't yet reviewed that article now is a good time as it has information that will make this month's article less confusing.

Navigating Gets More Complex

As we discussed last month you "navigate" between folders using the CD (change directory) command and that command, like all command line file and folder operations depends on you supplying good info on folder locations and names.

In the earlier examples I took the easy way out and used folder names that had eight character names or less. The complex gets even more complex when you folder Windows provision for long file names into the mix.

Until Windows 95 PC’s used eight character filenames with a three character extension and the command line environment maintains this standard. Thus when you run into a Windows long filename at the command line, things get weird as the filename is truncated and perhaps not like you’d think.

Navigate to the root folder using the CD command:

cd\

Now list the files using the dir command.

Look at the list closely and you’ll see some common Window folder names on the right hand side of the display. For instance you probably have a \program files folder listed. Look to the left and you’ll see the eight character version of that folder called progra~1.

Therefore when you’re at the command prompt you’d use the progra~1 name. Try it now:

cd\progra~1

Type dir and you should see a list of the folders in the program files folder that look familiar. Remember that you can always use the dir command to display the file or folder name that you need to use in the command prompt environment.

Copy It

The command line allows you to copy files from one location to another. Why would this be important? Recently someone used the SFC program to update the user.exe file. What they didn’t know is that the computer vendor had customized user.exe and the version on the Windows CD-ROM wasn’t compatible. As a result Windows wouldn’t start.

At this point a complete restore was done but it wasn’t needed, instead it would have been possible to restore the single file from the command line.

The copy command looks like this:

copy s:\folder\file.ext d:\folder

Where s:\folder\file.ext is the source drive, \folder is the source folder and file.ext is the filename and extension and d:\folder is the destination drive and folder.

So, how does one restore user.exe if Windows won't start? Boot from the Emergency disk and use the DOS command line:

copy c:\windows\helpdesk\sfc\user.exe c:\windows\system

Copies the file user.exe from the folder \sfc in the helpdesk folder which is in the windows folder and copies it to the system folder in the windows folder.

While it may seem complex it’s a lot better than losing all your personal files that often happens with a recovery restore.

What if you want to delete a file in Windows and it won’t allow it because Windows is using the file? Easy, do it from the command prompt. We’ll take that up along with some closing concepts in our final tutorial next month.

Until then best in computing.

Go to part 1.

Go to part 3.

Back to article index
     
   
  PCNet privacy policy    Copyright, 2010. pcnet-online.com