Aşağıdaki kodu çalıştırdığımda "taskkill beklenmiyor" alıyorum. Program% stop% değerini ayarlayabilmeden kapanır. Bu hatayı nasıl düzeltebilirim?Batch - komutu beklenmiyor
@echo off
set ucs=ucs.exe
cls
echo.
echo Check %ucs%...
tasklist /FI "IMAGENAME eq %ucs%" 2>NUL | find /I /N "%ucs%">NUL
if %errorlevel%==0 (
echo %ucs% is running!
echo You need to stop it before editing ucsdb
echo 1 - Stop
echo 0 - Menu
set /p "stop=Stop %ucs%?"
if %stop%==1 taskkill /im %ucs% /t && goto sqlitebrowser
if %stop%==0 goto sqlitemenu
if not %stop%==1 if not %stop%==2 echo Option "%stop%" not exist! && timeout /t 2 /nobreak >NUL && goto sqlitemenu
) ELSE (
echo %ucs% is not running
echo Loading SqliteBrowser...
timeout /t 2 /nobreak >nul
goto sqlitebrowser)
Kod Düzenleme:!!!!
setlocal EnableDelayedExpansion
cls
echo.
echo Check %ucs%...
pause
tasklist /FI "IMAGENAME eq %ucs%" 2>NUL | find /I /N "%ucs%">NUL
if %errorlevel%==0 (
echo %ucs% is running!
echo You need to stop it before editing ucsdb
echo 1 - Stop
echo 0 - Menu
set /p "stop=Stop %ucs%?"
if !stop!==1 taskkill /im %ucs% /t && goto sqlitebrowser
if !stop!==0 goto sqlitemenu
if not !stop!==1 if not !stop!==0 echo Options "!stop!" not exist! && timeout /t 2 /nobreak >nul && goto sqlitemenu
...
stop değilse == 1 stop değilse == 0 "! Dur!" Seçenekler yankı mevcut değil!
if %errorlevel%==0 (
Bunların hepsi tek bir satırda varmış gibi davranılır kapanış parantez kadar komutları anlamına gelir: işe değil düzgün
Oldukça eminim '% stop%' değişkeni tanımlanmamış ... – aschipfl
Olası çoğaltması [Toplu dosyada gecikmeli genişletme örneği] (http://stackoverflow.com/questions/10558316/example-of- gecikmeli-genişletme-toplu iş dosyası) –
Program% stop% değerini ayarlayabilmeden önce kapanır. Düzenlenmiş kodunuza (son kod satırı) – Blank517