What idiot would hard-code the path to Notepad?

Raymond Chen

There seemed to be a great deal of disbelief that anybody would hard-code the path to Notepad. Here’s one example and here’s another.

There’s a large class of problems that go like this:

I’m running Program X, and when I tell it to view the error log, I get this error message: CreateProcess of "C:\Windows\Notepad.exe errorlog.txt" failed: error 2: The system cannot find the file specified. What is wrong and how do I fix it?

Obviously, the file C:\Windows\Notepad.exe is missing. But how can that be? Well, Windows Server 2008 bit the bullet and removed one of the copies of Notepad. Once you learn this, troubleshooting the above problem becomes a simple exercise in psychic debugging.

My psychic powers tell me that you’re running Windows Server 2008. The Notepad program no longer exists in the Windows directory; it’s now in the system directory. Find the setting for your program that lets you change the program used for viewing error logs and tell it to use C:\Windows\System32\Notepad.exe.

Of course, this tip works only if the program permits you to change the program used for viewing error logs. If they hard-code the path, then you’ll have to find some other workaround. (For example, you might try using the CorrectFilePaths shim.)

0 comments

Discussion is closed.

Feedback usabilla icon