Show Current Working Folder or Directory Full Path in Batch Command Script Show actuel du dossier de travail ou d'un répertoire Full Path dans le premier lot de commandes de scripts
When executing a batch command script (in .cmd or .bat file extension), sometimes it's useful to get to know the current working directory of the batch script. Lors de l'exécution d'un script de commande de lot (en. Cmd ou extension de fichier. BAT), il est parfois utile de connaître le répertoire courant du script batch. Knowing the current directory or working folder in batch command is useful to ensure that the script is calling command or program at correct path, or manipulation of file and folder is done at valid destination when using relative path. Connaître le répertoire courant ou de dossier de travail de commande de lot est utile de veiller à ce que le script appelle la commande ou du programme en bonne voie, ou la manipulation des fichiers et des dossiers se fait à destination valide pour l'utilisation de chemins relatifs. Another important usage is to capture and save the current directory for later use, and the script may change the path during its course. Un autre usage important est de capturer et de sauvegarder le répertoire courant pour une utilisation ultérieure, et le script mai changer le chemin pendant son cours.
In fact, the showing and displaying of current directory is easy with the use of pseudo-variable for cmd.exe environment variables. En fait, la présentation et l'affichage du répertoire courant est facile avec l'utilisation de pseudo-variable pour les variables d'environnement cmd.exe. From Windows 2000 onwards, Microsoft Windows has added %CD% pseudo-variable that expands to the current working directory. Partir de Windows 2000, Microsoft Windows a ajouté pseudo% CD% variable qui élargit le répertoire de travail courant.
For example, to display current working directory, just use the following command: Par exemple, pour afficher le répertoire courant, il suffit d'utiliser la commande suivante:
Echo %CD% Echo% CD%
To save and store the current directory where a file is located for later use after change directory (cd) to other folder to perform other operations, use the following commands: Pour enregistrer et stocker le répertoire courant où un fichier se trouve pour une utilisation ultérieure après avoir changer de répertoire (cd) dans le dossier des autres pour effectuer d'autres opérations, utilisez les commandes suivantes:
Set CURRENTDIR=%CD%
The %CURRENTDIR% variable to store the current working directory, which can be used in later batch commands, which as changing back to this previous directory. Le% currentDir% variable pour stocker le répertoire de travail courant, qui peuvent être utilisés dans les commandes de commandes plus loin, ce qui change en revenir à ce répertoire précédent.
In Windows 9x, the %CD% pseudo-variable is not existed. Sous Windows 9x, le pseudo% CD% variable n'est pas existé. To get the current directory, use the following trick: Pour obtenir le répertoire en cours, utilisez l'astuce suivante:
CD | Time | Find ":\" > Temp1.Bat
Echo Set CD=%%4 %%5 %%6 %%7 %%8 %%9 > Enter.Bat
Call Temp1.Bat
Del Temp1.Bat
Del Enter.Bat
The end result is a variable %CD% been returned to the batch processing session which contains the current working directory. Le résultat final est une variable%% CD été renvoyé à la session traitement par lot qui contient le répertoire de travail courant.
IMPORTANT : The page is machine translated and provided "as is" without warranty. IMPORTANT: La page est traduit et machine fournis «tels quels», sans garantie. Machine translation may be difficult to understand. La traduction automatique mai être difficile à comprendre. Please refer to S'il vous plaît se référer à original English article Article original en anglais whenever possible. mesure du possible.
Related Articles Related Articles
- Open Elevated Command Prompt Window Here as Administrator at Current Folder Directly in Vista Windows Explorer Open Elevated Command Prompt Window Here as Administrator chez Current dossier directement dans l'explorateur de Windows Vista
- Windows Vista and Server 2008 Services Optimization (with Batch Command Script Optimizer) Windows Vista et Server 2008 Services Optimization (with Batch Command Script Optimizer)
- Script to Backup Current Start State (Startup Type) of Windows Services Script de sauvegarde de l'État de courant de démarrage (Startup Type) de Windows Services
- Reveal and Access to Windows Vista Hidden Context-Sensitive (Right Click) Menu Item – Open Command Prompt Here & Copy as Path Révéler et l'accès à Windows Vista Hidden Context-Sensitive (Right Click) Menu Item - Open Command Prompt Here & Copy as Path
- Reveal, Copy and Get File Full Path with Copy as Path in Windows Vista Reveal, Copy and Get File Full Path with Copy as Path in Windows Vista
- TimerLock Automated Batch Install Script for TimerStop Driver v2a and Windows Vista Activation 2099 Crack Timerlock lot d'installation automatique de scripts pour TimerStop Driver V2A et Windows Vista Activation Crack 2099
- How To Mount and Access New Partition, Volume or Drive As Folder Path In Windows Comment monter et un nouvel accès de cloisons, de volume ou le lecteur en tant que dossier chemin dans Windows
- Automatically Expand Navigation Pane Tree to Current Folder in Windows 7 Automatiquement Expand Tree volet de navigation vers le dossier actuel dans Windows 7
- Add Open Command Window Here to XP Folder with PowerToy Ajouter Open Command Window Here to XP dossier avec PowerToy
- Vista IE7 Cache & Cookies Folder, Temp Directory and History Location Vista IE7 Cache & Cookies Folder, Temp Directory and History Location









































