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   -
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

1 réponse

  1. dubcek Messages postés 18627 Date d'inscription   Statut Contributeur Dernière intervention   5 660
     
    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