Download Fixpath2.zip and unzip it. FIXPATH.EXE is
the program, and FIXPATH.TXT contains:
FIXPATH - (C) 2004 by Bill Stewart ([email protected]) BACKGROUND I'm a regular in the microsoft.public.win2000.cmdprompt.admin newsgroup, and the following type of question is one we see quite often: "Why doesn't my ping \[or ipconfig, or net, or whatever\] command work?" Some users have noticed that if they manually change to their system32 directory, the commands start working again. Magic! No, not really, once you understand how the operating system searches for commands. A simplified overview is below: 1. If the command includes a directory name, the command interpreter (usually cmd.exe) checks if the specified executable exists in the specified directory. If it exists there, the command interpreter runs the executable; otherwise, it reports an error message. 2. If the command does not include a directory name, the command interpreter checks the current directory for a matching program. If the program is found, the command interpreter runs it; otherwise, it skips to the next step. 3. The command interpreter searches each directory specified in the Path environment variable in order, for a matching program. If it exists in any directory in the path, the command interpreter runs it; otherwise, it reports an error message. So, then, the first thing you should check is the Path environment variable. However, this is just slightly more complex than you might expect at first blush. When Windows is first installed, it configures a Path setting as follows: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\system32\Wbem This setting is stored in the Path value in the registry in the following registry key: HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment The setting must be of type REG_EXPAND_SZ, which tells Windows that the registry value contains environment variable values to be expanded. In other words, if you look at your Path setting in the Environment Variables dialog box (right-click My Computer, click Properties, etc. etc. etc.), you'll see the percent signs, but if you type the command "set path" at a command line, you'll see them expanded correctly. So then, there are two conditions that determine a "correct" Path setting: 1. It must be of type REG_EXPAND_SZ 2. It must contain the minimum required directories The most likely cause of problem #1, above, is an incompetently-written installation program that attempts to update the Path and gets it wrong. #2 might be caused by an upgrade to Windows 2000/XP/whatever from some earlier version. This program, FIXPATH.EXE, attempts to fix these problems, if detected. It was written in Pascal and can be compiled with the Win32 version of the Free Pascal compiler (http://www.freepascal.org/). VERSION HISTORY See source code (FIXPATH.PP) for the version history. SYSTEM REQUIREMENTS Windows 2000 or later. RUNNING THE PROGRAM Open a command prompt window, and run FIXPATH.EXE. It will display some preliminary information, and ask if it should continue. If it successfully updates the Path value in the registry, you will need to reboot for the change to take effect. You can run the program without user interaction by specifying /Q on the command line; e.g. 'FIXPATH /Q'. COMMON MESSAGES "RegOpenKeyEx returned error 5." You don't have enough permissions to modify the registry. Error 5 means "access denied." For any message that returns an error number, you can use "net helpmsg x" (where x is the number) to see the text version of that error number. "Error! Path value not found in registry!" Just what it says. The Path value is missing. FIXPATH will attempt to create the value with the correct data type and contents. "Error! The registry value type is not REG_EXPAND_SZ!" The Path value is the wrong data type. FIXPATH will try to fix this. "Error! The minimum required directories were not found in the Path!" The Path value doesn't start with the correct directories. FIXPATH will try to fix this also. Let me know if you get any other error messages. Bill Stewart [email protected]
0 comments
Hide comments