Sous programme batch

Fermé
Kukel - 6 juil. 2017 à 13:49
barnabe0057 Messages postés 14440 Date d'inscription lundi 2 mars 2009 Statut Contributeur Dernière intervention 19 avril 2024 - 6 juil. 2017 à 14:56
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

barnabe0057 Messages postés 14440 Date d'inscription lundi 2 mars 2009 Statut Contributeur Dernière intervention 19 avril 2024 4 908
Modifié le 6 juil. 2017 à 14:40
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
barnabe0057 Messages postés 14440 Date d'inscription lundi 2 mars 2009 Statut Contributeur Dernière intervention 19 avril 2024 4 908
Modifié le 6 juil. 2017 à 15:04
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