How can I pass a double quote (") value to reg.exe?

A. Reg.exe is a tool that ships with Windows XP (and comes as part of the Windows 2000 resource kits) that lets you manipulate the registry from the command line. To pass a value that contains quotes, you must add a slash (\) before each quote as an escape sequence. For example,

G:\>reg add HKLM\Software\sav /v test /t REG_SZ /d "%userprofile%"

adds the user profile value without the quotes. However,

G:\>reg add HKLM\Software\sav /v test /t REG_SZ /d "\"%userprofile%\""

maintains the quotes around the user profile value. For example, for user profile savijo, including the slashes sets the registry value to "G:\Documents and Settings\savijo" rather than just G:\Documents and Settings\savijo.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.