%~dp0 is only available within a batch file and expands to the drive letter and path in which that batch file is located (which cannot change). It is obtained from %0 which is the batch file's name.
An experiment like the following shows the difference
Here is E:\dirpath.bat:
echo this is %%cd%% %cd% echo this is %%~dp0 %~dp0
Run it from C:\ and this is what you see
Code:
C:\>E:\dirpath.bat this is %cd% C:\ this is %~dp0 E:\
No comments:
Post a Comment