HelpAdding a program to autorun after being ran

Posts 1–4 of 4 · Page 1 of 1
Adding a program to autorun after being ran
I like to make little harmless troll program's and I want to upgrade them.
My idea is to make a small troll program that sets itself to autorun when someone starts their PC
Help, suggestions and anything of use is welcome.
Thanks in advance
This sort of goes without saying, but if you want the user of the application to have the option of making it a user-based startup (only auto-loads when certain users sign in) you can put in into the CurrentUser registry folder:

HK_Current_User\Software\Microsoft\Windows\Current Version\Run

If you wanna make your program put this in automatically, you can insert the key with code such as this:
Code:
Dim CU As Microsoft.Win32.RegistryKey = _
    Registry.CurrentUser.CreateSubKey _
    ("SOFTWARE\Microsoft\Windows\CurrentVersion\Run")

With CU
    .OpenSubKey("SOFTWARE\Microsoft\Windows\ _
    CurrentVersion\Run", True)
    .SetValue("MyProgram", AppPath)
End With
Where in this example, "AppPath" would be the full path of your program, INCLUDING the executable name. For example:

C:\Program Files\Temp Program\MyProgram.exe


Hope this helps!
Quote Originally Posted by Matroix73 View Post
This sort of goes without saying, but if you want the user of the application to have the option of making it a user-based startup (only auto-loads when certain users sign in) you can put in into the CurrentUser registry folder:

HK_Current_User\Software\Microsoft\Windows\Current Version\Run

If you wanna make your program put this in automatically, you can insert the key with code such as this:
Code:
Dim CU As Microsoft.Win32.RegistryKey = _
    Registry.CurrentUser.CreateSubKey _
    ("SOFTWARE\Microsoft\Windows\CurrentVersion\Run")

With CU
    .OpenSubKey("SOFTWARE\Microsoft\Windows\ _
    CurrentVersion\Run", True)
    .SetValue("MyProgram", AppPath)
End With
Where in this example, "AppPath" would be the full path of your program, INCLUDING the executable name. For example:

C:\Program Files\Temp Program\MyProgram.exe


Hope this helps!
Thanks! Will try this now!
c:
Let me know if its working or not
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us