Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the current directory the file executed is in using batch of windows?

I'm not familiar with this programming language,in PHP it's getcwd().

like image 226
user198729 Avatar asked Jan 23 '23 10:01

user198729


1 Answers

Not entirely sure I understand your question but:

The current directory is held in the pseudo-variable %CD%

Getting the directory that the Batch file is located in can be done as follows:

%~dp0 

%0 is the name of the batch file. ~dp gives you the drive and path of the specified argument.

like image 111
Martin Avatar answered Jan 29 '23 21:01

Martin