Unable to launch notepad from 'Run' or view HTML source

Today I experienced something weird.
Normally I run a lot of files just from 'Run' (Win+R), but today I did 'Run', 'notepad', and nothing happened...

This was weird.. As I could still open .txt files with Notepad.
I could not run notepad from 'Run'! I was amazed, I mean,.. what could break notepad? :)

First I checked if the file was still there (ofcourse, how could I still view files otherwise..), and if my PATH variable still included Windows. Everything seemed ok.

But then I found it, it only seemed as I could not run notepad.

What happened was the following: There was a notepad.com file in the system32 dir all of the sudden (spyware, virus, don't know). And Windows decided to run that one instead of notepad.exe

So it seems Windows prefers .com over .exe when trying to run a file without an extension.

Why does this happen?

There's another environment variable, called PATHEXT, with the following data:

PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH

Now you can clearly see the order of the files. I tried the same thing with a .bat and .exe file, and changing the env var, and it worked.

I'm not sure if the .COM has to be the first in line for normal system operations?

One side-effect of this was that when I wanted to View Source of a HTML page, it would also launch the notepad.com which did nothing, and thus not showing any source! I remember a lot of people complaining about not being able to view the source of their pages, this could be what's causing it!

Hopefully I'm telling something 'new' here, that's usefull ;) I never knew that order of extensions.

9 Comments

  • The problem with not being able to view source of a web page (from IE) can crop up when you have a very large temporary Internet files folder, another symptom is when you right click an image to save it disk the save as dialoge will only allow .bmp extension. just clear your temp files ( Tools > Internet Options > General Tab > Delete Files) and the problem goes away :)

  • Nice! That happened to me a few months ago. I fixed it by downloading TweakUI and Notepad2. Now I will know what to look for if it ever happens again! Thanks!

  • .COM's have been run in preference to .EXE's since the days of DOS.



    Some viruses back then including PowerPump used to just create a hidden .COM that matched a .EXE name giving it chance to copy itself before launching the .EXE



    I'd strongly recommend finding out exactly what notepad.com is on your system ASAP. I can't think of anything legitimate...

  • I can view source again! I cleared my temporary internet files, which took about 5 minutes, and now source opens. Thanks for the tip!

  • Ow yeah, I knew that problem of 'too many temporary Internet files', but the extensions, I didn't knew that .COM is taken before .EXE, kinda strange

  • It may be just for XP Home edition but if you put a shortcut to Notepad on your desktop, view source will stop working. I added a shortcut for my son to kick off notepad to practice typing and that broke IE's view source. Renaming the shortcut fixed it.

  • hmmm, now i see why you don't have to place the extention, if you want to strat notepad from RUN :p

  • is this problem sorted out? I have the same problem as you mentioned. What is the exact solution?

  • Aha, I fixed it out. But strange, there was 2 applications under windows\system32, notepad.exe and notpad.exe. I tried to copy a new notepad.exe from another computer to mine, and it said that "I am trying to copy ower notpad.exe. Could it be because of a trojan or virus? Anyway I backed up old files, I copied the new notepad to the original path and I deleted notpad.exe. It works.

Comments have been disabled for this content.