What is the best way to find out where notepad.exe and mspaint.exe are that will work across various versions of Windows?
Should I get the Windows directory via SHGetFol
This works on every Windows box I've got access to (XP+).
c:\> for %i in (cmd.exe) do @echo %~$PATH:i
C:\WINDOWS\system32\cmd.exe
c:\> for %i in (python.exe) do @echo %~$PATH:i
C:\Python25\python.exe
The great thing is, you don't have to use the actual %PATH%
, you can substitute your own search path by using a different environment variable.