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

John Savill

May 20, 2003

1 Min Read
ITPro Today logo in a gray background | ITPro Today

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 HKLMSoftwaresav /v test /t REG_SZ /d "%userprofile%"

adds the user profile value without the quotes. However,

G:>reg add HKLMSoftwaresav /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 Settingssavijo" rather than just G:Documents and Settingssavijo.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like