Commandes DOS

Introduction modifier

Commande interne DOS, elle est utilisée dans un batch pour appeler un autre fichier batch, ou une sous-routine située à un label particulier du fichier. Après la commande, l'exécution se poursuit à l'instruction suivante.

Utilisation modifier

Pour appeler un autre fichier batch :

CALL chemin arguments

Pour appeler une sous-routine située à un label particulier du fichier batch :

CALL :label arguments

Exemple 1 : appeler un autre fichier batch modifier

@ECHO OFF
CALL config.bat
ECHO Retour au batch principal

Exemple 2 : appeler une sous-routine du fichier batch modifier

@ECHO OFF
CALL :affiche C:\Windows
CALL :affiche C:\Temp
GOTO :eof

:affiche
ECHO Le contenu du répertoire %1 est :
DIR %1
GOTO :eof

Pour sortir du batch ou terminer la sous-routine, le label spécial :eof est utilisé.