This could would not even compile. Please make sure it compiles and paste the code right from your real code sample. The key should be in quotation marks.
Even though this is not cause any error
Application.ExecutablePath.ToString()
, this is ridiculous: ToString is redundant because
ExecutablePath
is already a string.
Now, I'm not sure CurrentUser is right. More likely, the key should be:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
Perhaps you tried to register software for one user and tried to run it as another one.
What else? Here is my secret weapon to find out all points where an application can be started: Sysinternals AutoRuns. Load Sysinternals Suite:
http://technet.microsoft.com/en-us/sysinternals/bb842062[
^], unpack and run AutoRuns, read its help, find all places where the program can be started automatically. There is a feature to jump to the registry key from any item using Regedit. This utility will provide you comprehensive information on the topic.
—SA