Creer condition avec une contenance (batch)

Fermé
Darkdiamant64 Messages postés 15 Date d'inscription mardi 1 avril 2014 Statut Membre Dernière intervention 25 janvier 2015 - 24 janv. 2015 à 21:17
dubcek Messages postés 18718 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 22 mars 2024 - 25 janv. 2015 à 10:16
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
A voir également:

1 réponse

dubcek Messages postés 18718 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 22 mars 2024 5 615
25 janv. 2015 à 10:16
hello
on teste avec findstr
C:> 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%
)
0