Page 1 of 1
VBS Script to edit Registry
#1
Posted 23 September 2005 - 04:13 PM
Hey Guys, I need a Visual Basic Script that can Edit the registry. I want to add a program to the startup list from a script. If someone could write that for me that would be great [With an example program of where the real one should go] Thanks
#2
Posted 23 September 2005 - 05:50 PM
frostbite1000, on Sep 23 2005, 11:13 PM, said:
Hey Guys, I need a Visual Basic Script that can Edit the registry. I want to add a program to the startup list from a script. If someone could write that for me that would be great [With an example program of where the real one should go] Thanks 
<{POST_SNAPBACK}>
<{POST_SNAPBACK}>
This place a short cut in the all user start up menu it set to open
notepad
Quote
Option Explicit
Dim Act, Scut, WD, All_UP : Set Act=CreateObject("Wscript.Shell")
ALL_UP = Act.ExpandEnvironmentStrings("%AllUsersProfile%") : WD = Act.ExpandEnvironmentStrings("%windir%")
Set Scut = Act.CreateShortcut(ALL_UP & "\Start Menu\Programs\Startup\SCNotepad.lnk")
Scut.TargetPath = WD & "\Notepad.exe"
Scut.WorkingDirectory = WD
Scut.Save
Dim Act, Scut, WD, All_UP : Set Act=CreateObject("Wscript.Shell")
ALL_UP = Act.ExpandEnvironmentStrings("%AllUsersProfile%") : WD = Act.ExpandEnvironmentStrings("%windir%")
Set Scut = Act.CreateShortcut(ALL_UP & "\Start Menu\Programs\Startup\SCNotepad.lnk")
Scut.TargetPath = WD & "\Notepad.exe"
Scut.WorkingDirectory = WD
Scut.Save
#3
Posted 24 September 2005 - 03:43 AM
If you are wanting to add to the Run section of the registry, then something like this perhaps:
Const constHKEY_LOCAL_MACHINE = &H80000002
Const constComputer = "."
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
constComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
strValueName = "MyVal"
strValue = "Drive:\PathTo\MyFile.ext"
objReg.SetStringValue constHKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue
You would simply need to change the strings 'strValueName' and 'strValue' to your specific needs
- ← In need of Printer remove script
- Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
- Creating a Socket on port 67 (DHCP Listener) →
Share this topic:
Page 1 of 1



Help
Back to top









