title: Add Registry Key Data With Quotes
body: <p>I have written a batch that adds a new registry value under a specified key. The data value is a file path and must have outer quotes like so: </p>
  
  <pre><code>"C:\Program Files\Microsoft Office\Office15\Library\Custom_AddIn.xlam"
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/nk1qg.png" alt="enter image description here"></p>
  
  <p>But even when using escape characters to keep the quotes, the closest I've been able to get is this (missing first quote):</p>
  
  <pre><code>C:\Program Files\Microsoft Office\Office15\Library\Custom_AddIn.xlam"
  </code></pre>
  
  <p>using this code:</p>
  
  <pre><code>setlocal enableDelayedExpansion
  setlocal ENABLEEXTENSIONS
  
  SET VERSION=15.0
  SET PATH="C:\Program Files\Microsoft Office\Office15\Library\Custom_AddIn.xlam"
  
  REG add HKEY_CURRENT_USER\Software\Microsoft\Office\%VERSION%\Excel\Options /v OPEN /t REG_SZ /d %PATH%^" /f
  </code></pre>
  
  <p>If I try to add the carrot and quote to the beginning of the path, the batch doesn't add the value at all. </p>
  
  <p>I've also tried using <code>\</code> to keep the quotes to the same effect: one at the end keep the last quote, one at the beginning keeps the value from being added altogether.</p>
  
  <p>What am I doing wrong here? According to the answers to <a href="https://stackoverflow.com/questions/9560709/adding-a-registry-key-in-windows-with-quotes-needed-in-the-data-using-a-batch-sc">this question</a>, what I'm doing should work...</p>