I need to associate a file extension. I created ".rulog" using notepad.exe as part of installing the installation project for the Windows 7 machine (it is here because we need administrator rights to write to the registry).
Basically I need to programmatically get the exact path to notepad.exe. Now I understand that he usually lives in C: \ Windows \ system32. This is part of the PATH system environment variable, so I assume that I could iterate over all the PATH variables and check if "notepad.exe" exists by combining "notepad.exe" with the current path using File.Exists. However, this seems very awkward.
Essentially I need to add an entry to
Computer\HKEY_CLASSES_ROOT\.rulog\shell\open\command\
with the value of the path to the notebook.
By the way, I see .txt in:
Computer\HKEY_CLASSES_ROOT\.txt\ShellNew
matters to ItemName
"@%SystemRoot%\system32\notepad.exe,-470"
Perhaps I can just copy this value? Or is it dangerous? (For example, does not exist).
source share