简体   繁体   English

后藤是出乎意料的时间

[英]Goto was unexpected time

When I run the script Console prints goto was unexpected time , (I have bad English) 当我运行脚本时,控制台打印goto was unexpected time ,(我的英语不好)

@echo on
set versiyon=0.1
if %komut1%=="metin" goto metinapi
if %komut1%=="internet" goto internetapi
if %komut1%=="dosya" goto dosyaapi
if %komut1%=="sistem" goto sistem
if %komut1%=="versiyon"(
    echo %versiyon%
    pause
) 
color c 
echo Hata:Aranan sey bulunamadi!Aradiginiz seyi dogru yazdiginizdan emin 
olun!ya da frameworku guncelleyin. suanki verisyon:%versiyon% KOD:1
pause
:metinapi
if %komut2%=="degistir"(
    if %komut3%=="" goto null 
    if %komut4%=="" goto null 
    if %komut5%=="" goto null 
    setlocal ENABLEDELAYEDEXPANSION
    set str=%komut3%
    set str=%str:!komut5!=!komut4!%
    echo %str%
    pause
)
if %komut2%=="bul"(
    if %komut3%=="" goto null 
    if %komut4%=="" goto null 
    Echo.%komut3%| findstr /C:%komut4%>nul && (Echo.EVET) || (Echo.HAYIR)
    pause
)


:null
color c
echo Deger null olamaz!KOD:2
pause

You can say why komuts are empty beacause I want user input them like api.bat set komut1=metin set komut2=bul ... 您可以说为什么komuts是空的,因为我希望用户像api.bat set komut1=metin set komut2=bul ...一样输入它们api.bat set komut1=metin set komut2=bul ...

You haven't declared %komut1% , and therefore the if command failed as well. 您尚未声明%komut1% ,因此if命令也会失败。 And if the command if executed (right at the line #3), then it would be: 并且如果该命令if执行(右在行#3),那么这将是:

if =="metin" goto metinapi
   ^
   Error here, because "%komut1%" is equal to ""

To fix this, you may have to include double quotes " before and after %komut1% : 要解决此问题,您可能必须在%komut1%之前和之后加上双引号"

if "%komut1"=="metin" goto metinapi

Now not only that, but you may have to edit more commands in order to make it working, like after you fix line #3, you'll have to fix line #4 and #5, etc... 现在不仅如此,而且您可能还必须编辑更多命令才能使其正常工作,例如在修复第3行之后,您必须修复第4行和第5行,等等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM