[THIN] OT: How to VBScript to create reg_sz value that contains quotes?

  • From: Steve Snyder <kwajalein@xxxxxxxxx>
  • To: thin@xxxxxxxxxxxxx
  • Date: Sat, 8 Aug 2009 15:29:15 +1200

Trying to set a reg_sz value value via vbscript.

Here's a dump of what I want to set:


Windows Registry Editor Version 5.00



[HKEY_CURRENT_USER\Software\Classes\AcroExch.Document.7\protocol\StdFileEditing\server]

@="\"C:\\Program Files (x86)\\Adobe\\Acrobat 9.0\\Acrobat\\Acrobat.exe\""


But I can't get it to take the leading and trailing " marks - the string
value itself actually needs to contain an opening and closing "

So here's what one (who'd uneducated, like me:) ) would write, but it gags
on the "\"

If I take out the beginning "\ and the ending \" it will set the (Default)
key with the string, sans quote marks.

I haven't browsed Jeremy's blog yet - that's where I'm off to next! ;)



Set objWSHShell = Wscript.CreateObject("Wscript.Shell")
Const REG_SZ = "REG_SZ"

UpdateRegKey
"HKEY_CURRENT_USER\Software\Classes\AcroExch.Document.7\protocol\StdFileEditing\server\",
"\"C:\Program Files (x86)\Adobe\Acrobat 9.0\Acrobat\Acrobat.exe"\", REG_SZ

Sub UpdateRegKey(strRegPath, strValue, strType)
     objWSHShell.RegWrite strRegPath, strValue, strType
End Sub

Other related posts: