我的Windows批處理文件中出現「goto在這個時候是意外的」錯誤。就像下面。我不知道。任何人都可以幫助我?感謝轉到這個時候是意外的。批處理文件
@setlocal EnableExtensions EnableDelayedExpansion
@echo off
SET TEMPERL=%TMP%\perlversion.txt
for /f "tokens=*" %%a in (%TEMPERL%) do (
set line=%%a
if not "%line:subversion%"=="%line%" goto GETVERSION
)
:GETVERSION
set mainver=%line:*perl=%
set mainver=%mainver:~1,1%
echo This is perl %mainver%
:END
endlocal
並不需要'then'? – DevZer0
你有沒有試過裏面使用!變!而不是%變量%FOR循環? – Dale
@ DevZer0'然後'不需要批處理 – foxidrive