Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript to export Reg Branch

Status
Not open for further replies.

shuanpicto

Programmer
May 27, 2005
14
GB
I am looking to export a registry branch in VBscript.
This is the code i have:-
On Error Resume Next
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Set wshshell = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")

APPDATA = WshShell.ExpandEnvironmentStrings("%APPDATA%")

wshshell.Run "REGEDIT /e " & APPDATA & "\temp\wallpaper.reg" "hkey_current_user\Control Panel\Desktop\", 1, true

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

When i run this command in CMD it works :-
REGEDIT /E "%APPDATA%\Temp\wallpaper.reg" "hkey_current_user\Control Panel\Desktop\"

Can anyone help me ?

I don't want to just create a CMD and run that, but i may have to !!
 
Correction to [2]

[2'] Should read instead.
[tt] APPDATA = WshShell.ExpandEnvironmentStrings("%APPDATA%")
wshshell.Run "REGEDIT /e " & [red]chr(34) & [/red]APPDATA & "\temp\wallpaper.reg" [red]& chr(34)[/red] & "hkey_current_user\Control Panel\Desktop\", 1, true
[/tt]
My bad!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top