|
10.3. Command Prompt IntegrationNow that you know how to use the Command Prompt, you'll need to find ways to get to it quickly, so that it can be as useful as possible. 10.3.1. Turn the Address Bar into a Command PromptIf you select Run from the Start Menu, the box that appears is essentially a limited command prompt; you can execute any program, open any folder, or launch any Internet URL simply by typing it here. Explorer and your taskbar also have the Address Bar, which essentially accomplishes the same thing as Run. The problem with both the Run command and the Address Bar is that they can only be used to launch programs; they don't understand intrinsic DOS commands, like dir and copy (discussed earlier in this chapter). However, there is a way to have the Address Bar mimic all the functions of the Command Prompt and therefore have a true command prompt always within reach:
Here's how it works: the batch file reads what you've typed after the + and writes it to a new, but temporary, batch file. The new batch file is then executed, and the command you've typed is carried out. When it's finished, the temporary batch file is deleted. The plus key was chosen for the name of the batch file because it's convenient and not likely to conflict with any other software or commands; the one on your keyboard's numeric keypad is usually more convenient than the one near your backspace key (Shift-=). However, you can certainly replace + with any other character, such as ` or -, as long as you rename the batch file accordingly. There are some limitations to this design. Although it does mimic the Command Prompt, it only allows a single command at a time, after which the context is forgotten. What this means is that such commands as cd won't have much meaningyou can certainly type + cd directoryname, but the "current directory" will be forgotten once the command has been executed. To get around this, include the full path with your commands. Instead of the following series of statements: d: cd \myfolder del *.tmp just type this: + del d:\myfolder\*.tmp Of course, if you find that you need to type several consecutive commands, you can always just type cmd in the Address Bar to launch a full-fledged Command Prompt window. 10.3.2. Open a Command Prompt window in any folderIf you find yourself using the Command Prompt frequently, you'll probably benefit from the following solution. Instead of having to use the cd command to change to a given folder, you can simply open a Command Prompt window on the fly in Explorer, already rooted in the selected folder:
10.3.3. The Path Less TraveledAlthough it isn't really emphasized as much as it was in the heyday of DOS and Windows 3.x, the system path is still an important setting in Windows XP. It can be helpful as well as detrimental, depending on how it's used. The system path is simply a listing of folder names kept in memory during an entire Windows session. If a folder name is listed in your system path, you'll be able to run a program contained in that folder without having to specify its location. This is most apparent when you use the Start Menu's Run command, Explorer's Address Bar, or a Command Prompt window, and type a program filename, such as Notepad. If all is well, Notepad will start, even though you didn't specify the full path (e.g. c:\Windows) of the folder containing the notepad.exe file. This is because Notepad.exe is located in a folder that, by default, is listed in the system path. The path is one of several environment variables that are kept in memory from Windows startup until you shut down. In previous versions of Windows, the path was set with a line in the Autoexec.bat file (now obsolete); in Windows XP, all environment variables are set by going to Control Panel By default, the system variable, Path, contains the following folders:
This means that an executable (.exe file) placed in any of these folders is instantly accessible from any folder on the system. The %SystemRoot% element represents the Windows folder, usually c:\Windows, and is so specified to account for systems where the Windows folder has been placed on a different drive or in a different folder. One of the consequences of this design is that if two different versions of the same file are placed in two different folders in the path, only one of the available versions of the fileand not necessarily the most recent onemay be in use at any given time. Now, the same rules that apply to program executables also apply to shared files, such as .dll, .vbx, and .vxd files, so the issue of version control is an important one that can affect any application on your system. How do you escape this trap? First, remove any unnecessary directories from your path variable. Next, if you suspect a conflict with a specific file, try searching your hard disk for the filename (select Search and then For Files or Folders from the Start Menu, and select Local Hard Drives from the Look in list). If you see more than one copy of the file in the search results window, it could potentially cause a conflict. Widen the In Folder column in the Search Results window so you can see where each file is located. If one of them is in \Windows\System (or any other Windows subdirectories, for that matter), then it most likely belongs there. Compare the versions of the files by right-clicking, selecting Properties, and clicking on the Version tabs. Now, you want to end up with only the newest file on your system, so what you can do at this point is simply delete (or temporarily rename, to be on the safe side) all versions but the most recent. Then move the newest file to your \Windows\System32 folder if it's not already there. Note that this solution by no means applies to all .dll files, which is why it's smart to back up any files before continuing. Some files have identical names only by coincidence, although this is rare. Of course, deleting a file just because there's another around by the same name is not a good idea unless you know that the files serve the same purpose. One way to make sure is to look through all the information in the Version tab; if the Company Name and Product Name are the same, you can be pretty sure that the files are duplicates. On the other hand, if the files have vastly different sizes, odds are that one is not a suitable replacement for the other. |
|