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:
"C:\Program Files\Microsoft Office\Office15\Library\Custom_AddIn.xlam"
But even when using escape characters to keep the quotes, the closest I've been able to get is this (missing first quote):
C:\Program Files\Microsoft Office\Office15\Library\Custom_AddIn.xlam"
using this 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
If I try to add the carrot and quote to the beginning of the path, the batch doesn't add the value at all.
I've also tried using \
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.
What am I doing wrong here? According to the answers to this question, what I'm doing should work...