escape character in IF
问题 i tried this in different variations (like setlocal EnableDelayedExpansion)- but nothing works: echo off IF "%1"=="Debug^|Win32" set servicesConfig=Win2008.Debug echo Incorrect parametr %servicesConfig% pause > nul 回答1: As quotes escapes special characters you compare the content of %1 with Debug^|Win32 (including the caret). In your case you should use this @echo off IF "%~1"=="Debug|Win32" ( echo It's ok set servicesConfig=Win2008.Debug ) ELSE ( echo Unknown in "%~1" ) You can call it with