Script par lots - CD

Cette commande par lots aide à apporter des modifications à un répertoire différent ou affiche le répertoire actuel.

Syntaxe

cd

Exemple

L'exemple suivant montre comment la commande cd peut être utilisée de différentes manières.

@echo off
Rem The cd without any parameters is used to display the current working directory
cd
Rem Changing the path to Program Files
cd\Program Files
cd
Rem Changing the path to Program Files
cd %USERPROFILE%
cd
Rem Changing to the parent directory
cd..
cd
Rem Changing to the parent directory two levels up
cd..\..
cd

Production

La commande ci-dessus affichera la sortie suivante après avoir changé les différents emplacements de dossier.

C:\Users\Administrator
C:\Program Files
C:\Users\Administrator
C:\Users
C:\