How can I pass a percent sign (%) value to reg.exe?

A. Just as you can use a slash (\) as an escape character to pass a double quote ("), you can use a carat (^) as an escape character to pass a percent sign. For example,

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

maintains the user-profile value's percent sign. Without the carat, the reg.exe tool will evaluate the value between the percent signs; with the carat, reg.exe will leave the value unchanged.

Hide comments

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.
Publish