When listing processes using Process.GetProcesses() I sometimes see “notepad”, and sometimes I see “NOTEPAD”, sometimes I find process named “iexplore” sometimes “IEXPLORE”. (This is consistent with Task manager displaying “notepad.exe” vs “NOTEPAD.EXE”.)
What is even stranger the following code
ProcessStartInfo startInfo = new ProcessStartInfo(“notepad”);
Process result = Process.Start(startInfo);
Resulted on couple of occasions with “NOTEPAD” process being launched as opposed to “notepad”.
Unfortunately, using
Process.GetProcessesByName(“notepad”)
will NOT return any hits for processes with process with name “NOTEPAD”.
This looks to me like a bug, if process name should be either consistently case sensitive or not, if it is not, then the Process.GetProcessesByName(“notepad”) should return me processes shown in task manager as “NOTEPAD.EXE” as well as “notepad.exe”. After all, I seem to have no control over how the process will end up being named.
Am I missing something
Does uppercase "NOTEPAD" have any special meaning
Note, from my experience, this phenomenon affects Microsoft apps such a notepad, internet explorer, etc, and not other applications.
This pertains to .NET 2.0, have not tested other versions.
Thanks for your insights into this matter.
Robert

Process.GetProcessesByName and case sensitivity/uppercasing of process name
Anjan Ghose
moemen.ahmed
When you launch notepad from your .NET app, it won't find notepad.exe in its current working directory (initially, the same as the folder that contains the exe). So it walks through the paths in PATH. If c:\windows is first, it will launch "NOTEPAD.EXE".
When you click Start + Run, "notepad", it will first look in the working directory for the shell (explorer.exe). That is, no doubt, c:\windows\system32 so it will launch "notepad.exe".
Older versions of Windows (98 and before, I think) have a different search strategy; they look in PATH first. Fun stuff, in a geeky way. I'm a geek.
KervyChoa
HTH, nobugz, Thanks for all your help.
I am convinced that you are right, and will double check when I get access to that computer.
Would you know why some windows installations have both notepads lowercased and some have one lower and one uppercased
The workstation on which I am typing this post has both windows and system32 notepads appear in lower case when listed in Task Manager. (This is just a curiosity question).
Thanks a lot again.
Robert
tamri
Hi,
'nobugz' is right in his answer. But my point to say is, Process class is case-insensitive. So whether you give NOTEPAD, notepad or Notepad, it will start "notepad.exe" - may be in process list it can show in uppercase but it doesn't matter that what case you giving and what case it is showing.
If you create your own "exe", try creating a same exe copy with diff cases. and open multiple exe at the same time and watch the process.
Also try it renaming and start the process same way,... you will see that Windwos or Process class is NOT case sensitive this way.
If its not your answer, then please inform me with a bit more specific question,
HTH,
TheTheTheTheTheThe
Hans, This, quite possibly,is it! Thanks for this information. However ...
I have noticed the phenomenon only on one computer and I do not have access to it for time being. I just checked couple of other computers and both c:\windows and c:\windows\system32 are lower case notepads. Also what is realy strange that invoking C# code
ProcessStartInfo startInfo = new ProcessStartInfo("notepad"); Process result = Process.Start(startInfo);
resulted in "NOTEPAD" being launchend, why typing "notepad" in Start -> Run ... dialog would launch "notepad". That would suggest that system path was interpreted in different order by both launches.
I will run some checks on the computer which produced this strange behavior when I get access to it (hopefully in a week or so) and will post again.
Thanks for this interesting insight.
Robert