0

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 !!

2 Answers 2

2

For the current directory;

SET ABS_PATH=%cd% 
Sign up to request clarification or add additional context in comments.

1 Comment

Sorry i am able to get now...Thanks
0

It should be SET ABS_PATH=%~dp1 The %0 variable is the filename of the batch file itself.

1 Comment

This particular value set in ABS_PATH is not working to get the full path of the current directory.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.