VBScript in RunOnce Key

Status
Not open for further replies.

JohnAlpha

Beta member
Messages
2
Location
Pittsburgh, PA
I'm having some issues setting a .vbs file in the RunOnce registry key through a .reg file. My goal is to set a few scripts to do some configuration on new installations, but while trying to test things out today I realized I couldn't seem to set the values I needed. Here is a basic test .reg file I made:

Code:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
"Test"="This is a test."
"Script"="C:\test.vbs"

The Test value is created and set but the Script value is not. I noticed that this occurs anywhere in the registry, not just for the RunOnce key. However, if I manually go into the registry, make a new string, and then set the value to "C:\test.vbs" (or even something like "cscript C:\test.vbs"), it will set correctly. Furthermore, it actually functions, since any test scripts I tried would launch after a reboot.

Is this just some sort of convention I didn't know about that you can't use a .reg file to add scripts to run? I tried using Google, but I couldn't really find any information on this. If anyone could shed some light on this for me, I would really appreciate it.
 
Awesome, thank you!

Is there any particular reason why you have to use the double backslash for the file path when working in the registry? I'm just curious.
 
Status
Not open for further replies.
Back
Top Bottom