批处理文件 If / goto 语句未按预期工作。我不断收到语法错误,但我看不到它

Batch file If / goto statement not working as intended. I keep getting a syntax error but I can't see it

所以我下面的脚本有一个简单的任务,即在安全模式下启用或禁用 [​​=13=] 安装程序服务。不过,我很难看到它的问题。我确定我弄乱了顶部的 if / goto 部分,但我终生无法弄清楚我做错了什么。 vbs 的一小部分工作正常,比较的格式似乎正确,但它总是失败,并在第一个 if 语句中出现语法错误。任何指针将不胜感激。

Call :ChoiceBox "Do you want to activate the installer service?"
If %YesNo% == "6"(
    goto :AddRegkey
)
If %YesNo% == "7"(
    goto :RemoveRegkey
)
pause

:ChoiceBox
REM returns 6 = Yes, 7 = No Type=4 = Yes/No
set YesNo=
set MsgType=4
set heading=%~2
set message=%~1
echo wscript.echo msgbox(WScript.Arguments(0),%MsgType%,WScript.Arguments(1)) >"%temp%\input.vbs"
for /f "tokens=* delims=" %%a in ('cscript //nologo "%temp%\input.vbs" "%message%" "%heading%"') do set YesNo=%%a
exit /b 

:RemoveRegkey
net stop msiserver
REG DELETE "HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\MSIServer" /VE /T REG_SZ /F /D "Service"
REG DELETE "HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer" /VE /T REG_SZ /F /D "Service"
echo msgbox "Registry entries deleted." > %temp%\tempmsg.vbs
call %temp%\tempmsg.vbs
del %temp%\tempmsg.vbs /f /q
exit /b

:AddRegkey
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\MSIServer" /VE /T REG_SZ /F /D "Service"
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer" /VE /T REG_SZ /F /D "Service"
echo msgbox "Registry entries added." > %temp%\tempmsg.vbs
call %temp%\tempmsg.vbs
del %temp%\tempmsg.vbs /f /q
net start msiserver
exit /b
   v-------v    v-v    Quotes on both sides of compare operation
If "%YesNo%" == "6" (
                   ^   Missing space