0
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?
thanks for pointing out the typo and PATH misuse - fixed. – Neil Weicher – 2019-07-26T11:35:29.767
your answer made me realize that I did not post the question properly. Rather than an extensive redo, I will create a new question. Should I delete this one? – Neil Weicher – 2019-07-26T12:00:08.533
Question has been replaced by this question
– Neil Weicher – 2019-07-26T12:48:56.287