Reputation: 902
I have used a batch file in which i am setting absolute path variable as below
Code snippet(Batch File : brk_validation.bat)
SET ABS_PATH=%~dp0
echo Completed the Validation of files in %ABS_PATH%
Running the Batch Program on command prompt:
D:\Files>brk_validation.bat .
Output :
Completed the Validation of files in D:\Files\
Issue:
I have put the batch file in a different directory and then running the bat file by giving the full path of it as shown below:
D:\Files>D:\Work\brk_validation.bat .
Output :
Completed the Validation of files in D:\Work\
Expected Output:
Completed the Validation of files in D:\Files\
I want the current directory path where the files are present i.e. D:\Files for the above example.
So any help is appreciated. Thanks !!
Upvotes: 0
Views: 77
Reputation: 2638
It should be SET ABS_PATH=%~dp1
The %0
variable is the filename of the batch file itself.
Upvotes: 0