WENN VORHANDEN/WENN NICHT VORHANDEN, im batch-Skript

Ich habe ein kleines problem mit der batch-script, das ich Schreibe.

:Delete_File
cls
title Delete File
echo Welcome to the Utility Delete File!
echo Type the name of the file you want to delete:
echo.
set /p var=
echo.
echo I'm checking the existance of the file...
ping 192.0.2.2 -n 1 -w 2000>nul
if EXIST %var% del %var%
if NOT EXIST %var% echo The file doesn't exist. Check for errors and try again. 
ping 192.0.2.2 -n 1 -w 1500>nul
set /p answer=1 - Go to Menu _ 2 - Go to Exit 
if %answer%==1 goto Menu
if %answer%==9 goto Exit

So, das problem ist, dass wenn die Datei ist gegründet, Es wird gelöscht, aber dann zeigt es die Nachricht in der 12 string.
Ich muss die Meldung "Die Datei wurde erfolgreich gelöscht! Umleiten Sie auf das Menü..."

echo The file was successfully deleted!
echo Redirecting you to the Menu...
ping 192.0.2.2 -n 1 -w 2000>nul
goto Menu

Ich bin wirklich sorry für die schlechte syntax von der Frage, aber ich bin neu.

Danke für jede Antwort, die ich bekomme!!!

Federico.

  • Du meinst 12th Zeile code. Die Antwort unten Ihr problem löst, aber denken Sie an die Logik, die Sie verwenden, und Sie haben könnte, löste es sich. Flip-flop " - der Linien.
InformationsquelleAutor F. Tinelli | 2017-02-03
Schreibe einen Kommentar