Sous programme batch

Kukel -  
barnabe0057 Messages postés 14329 Date d'inscription   Statut Contributeur Dernière intervention   -
bonjour!! quelqu'un pour m'aider (en batch) en me disant comment créer un menu principal dans lequel sera appelé les sous programme comme
la gestion de fichiers
la calculatrice
l'installation automatique des programme sans redémarrage du systeme.

Merci!!!

2 réponses

  1. barnabe0057 Messages postés 14329 Date d'inscription   Statut Contributeur Dernière intervention   4 930
     
    Bonjour,

    Voilà la structure du menu, à toi de compléter les blancs :

    @echo off
    Title Menu principal
    Setlocal enableextensions enableDelayedExpansion

    :menu
    cls
    echo. & echo 1) la gestion de fichiers
    echo. & echo 2) la calculatrice
    echo. & echo 3) l'installation automatique
    echo.
    set /p choix="Votre choix : "

    if "!choix!"=="1" (call :gestion_fichiers)
    if "!choix!"=="2" (call :calculatrice)
    if "!choix!"=="3" (call :installation)

    goto menu

    Endlocal
    exit

    :gestion_fichiers
    ...
    ...
    ...
    ...
    goto :eof

    :calculatrice
    ...
    ...
    ...
    ...
    goto :eof

    :installation
    ...
    ...
    ...
    ...
    goto :eof

    rem



    “L'intelligence artificielle se définit comme le contraire de la bêtise naturelle.”
    1
  2. barnabe0057 Messages postés 14329 Date d'inscription   Statut Contributeur Dernière intervention   4 930
     
    Un exemple de ce que ça pourrait donner :

    @echo off
    Title Menu principal
    chcp 1252 >nul
    Setlocal enableextensions enableDelayedExpansion

    :menu
    cls & set choix=0
    echo. & echo 1) Ouvrir l'explorateur de fichiers
    echo. & echo 2) Accéder à la calculatrice
    echo. & echo 3) Lancer l'installation de Skype 7.22
    echo. & echo.
    set /p choix="Votre choix : "

    if "!choix!"=="1" (call :gestion_fichiers)
    if "!choix!"=="2" (call :calculatrice)
    if "!choix!"=="3" (call :installation SkypeSetup722)

    goto menu

    Endlocal
    exit

    :gestion_fichiers
    start explorer.exe
    goto :eof

    :calculatrice
    start calc.exe
    goto :eof

    :installation
    cd "%userprofile%\Downloads"
    if not exist "%~1.msi" (goto :eof)
    msiexec /passive /promptrestart /i "%~1.msi"
    goto :eof

    rem

    Pour l'option 3, il faut au préalable télécharger Skype 7.22 ici :
    https://sourceforge.net/projects/skype-installer-archive/


    “L'intelligence artificielle se définit comme le contraire de la bêtise naturelle.”
    0