Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Registry key name containing \

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,26629
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Registry key name containing \
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Registry key name containing \ - 10/2/2005 7:10:08 PM   
  yesbor

 

Posts: 2
Score: 0
Joined: 10/2/2005
Status: offline
I need to add a registry key name containing a backslash \ (ie a path to a specific file/program - C:\myfolder\myprogram)

I've tried:
WshShell.RegWrite "HKLM\mykey\c:\myfolder\myprogram", "REG_SZ" , "MyValue"

but as you would know this will create a tree ending with a key name called "myprogram".

Any solutions ?
 
 
Post #: 1
 
 RE: Registry key name containing \ - 10/2/2005 11:05:49 PM   
  mbouchard


Posts: 1863
Score: 14
Joined: 5/15/2003
From: USA
Status: offline
Sometimes it helps to do things backwards.  Manually enter your key into the registry, then export it.  You will notice that there will be \\ for each \ in a path.

ex

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Acrobat.exe]
"Path"="C:\\Program Files\\Adobe\\Acrobat 7.0\\Acrobat\\"

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to yesbor)
 
 
Post #: 2
 
 RE: Registry key name containing \ - 10/3/2005 12:40:37 AM   
  yesbor

 

Posts: 2
Score: 0
Joined: 10/2/2005
Status: offline
Well I've already tried:
WshShell.RegWrite "HKLM\mykey\c:\\myfolder\\myprogram", "REG_SZ" , "MyValue"

But the command creates a folder called "mykey" with a subfolder called "c:" with a subfolder called "myfolder" with a key named "myprogram" with the value "MyValue"....no good.

Instead I've now used a workaround:
1) Manually entered the key into the registry, then exported it to "myreg.reg".
2) In my script I use:
          Set oExec = WshShell.Exec("REG IMPORT myreg.reg")

seems to work....

(in reply to mbouchard)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Registry key name containing \ Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts