{"id":10193,"date":"2019-07-06T07:38:41","date_gmt":"2019-07-06T07:38:41","guid":{"rendered":"http:\/\/198.58.113.91\/blog\/?p=10193"},"modified":"2019-07-06T07:43:01","modified_gmt":"2019-07-06T07:43:01","slug":"add-a-registry-value-with-double-quotes-expandable-data-using-reg-exe","status":"publish","type":"post","link":"https:\/\/www.winhelponline.com\/blog\/add-a-registry-value-with-double-quotes-expandable-data-using-reg-exe\/","title":{"rendered":"Add registry values with double quotes or expandable variable data using Reg.exe"},"content":{"rendered":"<p>The built-in <code>reg.exe<\/code> console tool lets you add, delete, export or save (<a href=\"https:\/\/www.winhelponline.com\/blog\/automatically-backup-registry-hives-windows-10\/#reg_export_hives\">as hive<\/a>) registry keys and values. When adding registry values using the <code>reg.exe<\/code> tool, you may be wondering how to pass data with double-quotes or environment variables and add it to the registry literally.<\/p>\n<p>This article tells you how to create registry values passing double-quotes and environment variables (without expanding or resolving the folder path) using the reg.exe console tool.<!--more--><\/p>\n<h2>Add a registry value data with double quotes using REG.exe<\/h2>\n<p>Consider the following case. If you need to write to the <code>(default)<\/code> by setting its data to <code>\"d:\\my projects\\runx64.exe\"<\/code> with double quotes, you&#8217;ll need to escape the inner double-quotes using a backslash.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre>REG ADD HKCR\\boxfile\\shell\\command \/ve \/t REG_SZ \/d \"\\\"d:\\my projects\\runx64.exe\\\" \"\\\"%1\\\"\"<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10197\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/07\/reg-command-pass-quotes-3.png\" alt=\"reg.exe pass double quotes in data and expandable strings\" width=\"700\" height=\"132\" \/><\/p>\n<p>If you don&#8217;t escape the inner double-quotes around the data, such as:<\/p>\n<pre>REG ADD HKCR\\boxfile\\shell\\command \/ve \/t REG_SZ \/d \"d:\\my projects\\runx64.exe %1\"<\/pre>\n<p>The command will complete successfully, but you&#8217;ll end up creating the following registry key\/value without double-quotes:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10196\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/07\/reg-command-pass-quotes-4.png\" alt=\"reg.exe pass double quotes in data and expandable strings\" width=\"700\" height=\"133\" \/><\/p>\n<p><strong>Example 2:<\/strong><\/p>\n<pre>REG ADD HKCR\\boxfile\\shell\\command \/ve \/t REG_SZ \/d \"\\\"d:\\my projects\\runx64.exe\\\" -runmax \"\\\"%1\\\"\"<\/pre>\n<h2><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10198\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/07\/reg-command-pass-quotes-5.png\" alt=\"reg.exe pass double quotes in data and expandable strings\" width=\"700\" height=\"132\" \/><\/h2>\n<h2>Add a registry value containing expandable string data using REG.exe<\/h2>\n<p>To add a REG_EXPAND_SZ registry value type and pass an expandable string exactly as given (<strong>without expanding the variable<\/strong>), you&#8217;ll need to use the caret <code>^<\/code> symbol with the <code>%<\/code> symbol.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre>REG ADD \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" \/v Desktop \/t REG_EXPAND_SZ \/d ^%USERPROFILE^%\\Desktop<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10200\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/07\/reg-command-pass-quotes-6.png\" alt=\"reg.exe pass expandable string data without expanding\" width=\"700\" height=\"126\" \/><\/p>\n<p>If you don&#8217;t use the caret symbol, as in the following command-line example:<\/p>\n<pre>REG ADD \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" \/v Desktop \/t REG_EXPAND_SZ \/d %USERPROFILE%\\Desktop<\/pre>\n<p>The environment variable or expandable string is expanded or resolved to the folder path automatically, as shown in the following image.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10199\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/07\/reg-command-pass-quotes-7.png\" alt=\"reg.exe pass expandable string data without expanding\" width=\"699\" height=\"126\" \/><\/p>\n<p>Hope this article helped you pass complex command-line arguments involving double-quotes and expandable variables to the registry using the <code>reg.exe<\/code> command-line.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The built-in reg.exe console tool lets you add, delete, export or save (as hive) registry keys and values. When adding registry values using the reg.exe tool, you may be wondering how to pass data with double-quotes or environment variables and add it to the registry literally. This article tells you how to create registry values &#8230; <a title=\"Add registry values with double quotes or expandable variable data using Reg.exe\" class=\"read-more\" href=\"https:\/\/www.winhelponline.com\/blog\/add-a-registry-value-with-double-quotes-expandable-data-using-reg-exe\/\" aria-label=\"Read more about Add registry values with double quotes or expandable variable data using Reg.exe\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[7],"tags":[106,441],"class_list":["post-10193","post","type-post","status-publish","format-standard","hentry","category-windows","tag-command-prompt","tag-registry"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":19471,"url":"https:\/\/www.winhelponline.com\/blog\/cannot-import-reg-not-all-data-was-successfully\/","url_meta":{"origin":10193,"position":0},"title":"Cannot import .REG file; Not all data was successfully written to registry","author":"Ramesh","date":"October 22, 2020","format":false,"excerpt":"Sometimes, when applying the registry settings using a .reg file, you may get one of the following errors: Cannot import file.reg: Not all data was successfully written to the registry. Some keys are open by the system or other processes, or you have insufficient privileges to perform this operation. Cannot\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"cannot import .reg file - error accessing registry","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/10\/reg-file-import-error-4.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/10\/reg-file-import-error-4.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/10\/reg-file-import-error-4.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/10\/reg-file-import-error-4.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":1637,"url":"https:\/\/www.winhelponline.com\/blog\/cmd-default-for-folders-right-click\/","url_meta":{"origin":10193,"position":1},"title":"[Fix] &#8220;Cmd&#8221; is the Default Action for Folders (Right-click Menu)","author":"Ramesh","date":"February 14, 2016","format":false,"excerpt":"Summary: Default right-click action changes to Cmd for folders in Windows 10. Double-clicking folders shows the association error message.I've seen a few cases where the default action for folders somehow changed from Open to Cmd, showing up in bold when you right-click a file system folder. And clicking it shows\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/w10\/w10-cmd-default-2.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1088,"url":"https:\/\/www.winhelponline.com\/blog\/regfileexport-export-registry-key-hive-offline\/","url_meta":{"origin":10193,"position":2},"title":"RegFileExport Helps you Export Data from Offline Registry Hives","author":"Ramesh","date":"September 20, 2010","format":false,"excerpt":"RegFileExport is a useful console application from NirSoft, which helps you extract data from offline Registry hives that are not currently in use by the Operating System. RegFileExport reads the registry hive and then exports the specified branch or the entire branch to a .reg file. Regedit.exe can do this\u2026","rel":"","context":"In &quot;Utilities&quot;","block_context":{"text":"Utilities","link":"https:\/\/www.winhelponline.com\/blog\/category\/utilities\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1600,"url":"https:\/\/www.winhelponline.com\/blog\/outlook-hyperlinks-open-new-with-ie-set-default\/","url_meta":{"origin":10193,"position":3},"title":"Clicking a Hyperlink in Outlook Prompts to Select a Browser, With IE set as default","author":"Ramesh","date":"February 8, 2016","format":false,"excerpt":"When you click a hyperlink in Outlook 2007 or 2010 with Internet Explorer set as the default, the Open With window (\"How do you want to open this?\" dialog) appears with the list of browser choices. This is an issue in Windows 10 with Outlook 2007 or 2010 installed, and\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/w10\/ol-opennew-ie-1.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":9898,"url":"https:\/\/www.winhelponline.com\/blog\/automatically-backup-registry-hives-windows-10\/","url_meta":{"origin":10193,"position":4},"title":"How to Automatically Backup the Entire Registry in Windows","author":"Ramesh","date":"June 22, 2019","format":false,"excerpt":"Every System Restore point or shadow copy maintains a complete backup of the registry hives. However, Windows 10\/11 doesn't automatically create System Restore points every day. Restore Points are created only when installing important updates or drivers. Notwithstanding the System Restore's excellent capabilities, relying upon System Restore as a file\u2026","rel":"","context":"In &quot;Utilities&quot;","block_context":{"text":"Utilities","link":"https:\/\/www.winhelponline.com\/blog\/category\/utilities\/"},"img":{"alt_text":"backup registry daily or weekly - regidlebackup task","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/06\/registry-backup-task-regidlebackup.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/06\/registry-backup-task-regidlebackup.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/06\/registry-backup-task-regidlebackup.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":10301,"url":"https:\/\/www.winhelponline.com\/blog\/how-to-enable-command-prompt-autocomplete-path-if-it-stops-working\/","url_meta":{"origin":10193,"position":5},"title":"Fix: Command Prompt Tab to Autocomplete not working","author":"Ramesh","date":"July 12, 2019","format":false,"excerpt":"The Command Prompt has a handy little feature that lets to change directory paths using autocomplete. To change to a directory or type a directory name, you can type the starting letters of the directory and press the TAB key to autocomplete the file or folder path. (To learn how\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"autocomplete path characters in command prompt","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/07\/cmd-autocomplete-path.gif?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/07\/cmd-autocomplete-path.gif?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/07\/cmd-autocomplete-path.gif?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/10193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/comments?post=10193"}],"version-history":[{"count":0,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/10193\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/media?parent=10193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/categories?post=10193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/tags?post=10193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}