[THIN] Re: 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 16:01:46 +1200

ah triple-quotes... well duh.

On Sat, Aug 8, 2009 at 3:29 PM, Steve Snyder <kwajalein@xxxxxxxxx> wrote:

> 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: