Current Path Retrieval in DOS Script
Solved/Closed
denis
-
pate de canard -
pate de canard -
Il existe une commande dans un script DOS qui permet de récupérer le chemin complet du dossier dans lequel se trouve le script. Vous pouvez utiliser la commande suivante :
```batch
@echo off
set scriptPath=%~dp0
echo %scriptPath%
```
Cela affichera le chemin complet du dossier où se trouve le script lorsqu'il est exécuté.
```batch
@echo off
set scriptPath=%~dp0
echo %scriptPath%
```
Cela affichera le chemin complet du dossier où se trouve le script lorsqu'il est exécuté.
4 réponses
Regarding Denis's comment on March 22, 2007 at 1:57 PM, we will be careful not to add any space at the end of the string, as it is taken into account when running the command
set currentpath=%~dp0
set currentpath=%~dp0
Thank you for your response