This is driving me bananas but it must be something very simple. I am trying to add an ImagePath Value (REG_SZ) in a Batch script using REG ADD, where the Value Data contains embedded "double quotes". But I keep getting an "Invalid Syntax" error. This is the Value I am trying to add:
Key : HKLM\SYSTEM\CurrentControlSet\Services\MSSQL$SQLEXPRESS
Value: ImagePath REG_SZ
Data : "C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\Binn\sqlservr.exe" -sSQLEXPRESS
I tried enclosing the Data in single quotes:
@SETLOCAL
@SET IPATH="C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\Binn\sqlservr.exe" -sSQLEXPRESS
@REG.EXE ADD "HKLM\SYSTEM\CurrentControlSet\Services\MSSQL$SQLEXPRESS" /f /v ImagePath /t REG_SZ /d '%IPATH%'
I also tried enclosing in "double quotes", bang (!), [brackets], \backslashes\ and ^carets^ but I keep getting the syntax error.
Any idea what I am doing wrong?