Last active
September 11, 2020 12:59
-
-
Save DarkCat09/6b7226dc5afea2f4b5c8f6407e323a65 to your computer and use it in GitHub Desktop.
Script for adding programs to startup using registry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Script for adding programs to startup using registry | |
'Author: Chechkenev Andrew (DarkCat09/CodePicker13) | |
Option Explicit | |
Dim Wsh, pathToProgram, isForAllUsers, root, pathToProgramArr | |
Set Wsh = CreateObject("WScript.Shell") | |
pathToProgram = InputBox("Enter full path to program", "AddToStartup") | |
isForAllUsers = MsgBox("Add this program to startup for all users?", vbYesNo, "AddToStartup") | |
'MsgBox pathToProgram & " " & isForAllUsers | |
If isForAllUsers = vbYes then | |
root = "HKEY_LOCAL_MACHINE" | |
Else | |
root = "HKEY_CURRENT_USER" | |
End If | |
pathToProgramArr = Split(pathToProgram, "\") | |
Wsh.RegWrite root & "\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\" & Split(pathToProgramArr(UBound(pathToProgramArr)), ".")(0), pathToProgram, "REG_SZ" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment