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!

Export Registry Branch

Status
Not open for further replies.

shuanpicto

Programmer
May 27, 2005
14
GB
I am looking to export a registry branch in VBscript.

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

How can I run this in VBScript or Jscript ?

The problem lies in the speech marks.

I tried this:-

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

But i think my speech marks are all wrong.

Can anyone help me ?

I don't want to just create a CMD and run that, but i may have to !!
 
WshShell.Run "%APPDATA%\temp\wallpaper.reg " & Chr(34) & "hkey_current_user\Control Panel\Desktop\" & Chr(34), 1, True

should do it, environmentstrings are auto converted by .Run
 
wshshell.Run "REGEDIT /e """ & APPDATA & "\temp\wallpaper.reg"" ""hkey_current_user\Control Panel\Desktop\""", 1, true

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
WshShell.Run "regedit /e %APPDATA%\temp\wallpaper.reg " & Chr(34) & "hkey_current_user\Control Panel\Desktop\" & Chr(34), 1, True
 
did you have any luck with mine of PHV's suggestions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top