mercredi 28 septembre 2016

If and Set in a Batch file

I have a little problem : I try to put a choice to delete all the text files in the folder, but it's a bit hard. Here's my code :

@echo off 
if not exist *.txt (
echo Il n'y a pas de fichiers txt
) else (
dir /b *.txt
:start
echo voulez vous supprimer ces fichiers textes?
set input=
set /p input=Choice:
if %input%==y goto 1
if %input%==n goto 2
@REM Veuillez appuyer sur "y" ou "n".
@echo Le programme recommence.
goto start

1:
echo Fichiers supprimés 
2: 
echo Fichiers non supprimés
)

I tried with choice, but I can do more things with set.
Thanks for any answer, and also excuse me for bad english.
P.S: The sentences in 1 and 2 means Files deleted/Undeleted files

Aucun commentaire:

Enregistrer un commentaire