Creer condition avec une contenance (batch)
Darkdiamant64
Messages postés
15
Statut
Membre
-
dubcek Messages postés 18627 Date d'inscription Statut Contributeur Dernière intervention -
dubcek Messages postés 18627 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour je suis en train de coder un petit programme en batch et je voudrais savoir quand je fais mon petit menu de sélection comment je pourrais faire quelque chose qui ressemblerai a ceci:
set /p choice=Votre demande:
if %choice% (contient le mot) start goto :Start
set /p choice=Votre demande:
if %choice% (contient le mot) start goto :Start
1 réponse
-
hello
on teste avec findstrC:> cc
votre texte ?wdwcwscwsdcw
ne contient pas hello
C:> cc
votre texte ? coocou hello coucou
contient hello
C:> type cc.bat
@echo off
set texte=hello
set /p q=votre texte ?
echo %q% | findstr /I %texte%>NUL
if %errorlevel% EQU 0 (
echo contient %texte%
) else (
echo ne contient pas %texte%
)