"PsExec.exe" /accepteula -i -s "%~dp0tapinstall.exe" install "%~dp0driver\OemWin2k.inf" tap0901
%0
= reference to the current batch file
%~dp0
= drive and path where the batch file is located
Question
I have the following batch file:
"C:\TapTest\PsExec.exe" /accepteula -i -s "C:\TapTest\tapinstall.exe"
-> install "C:\TapTest\driver\OemWin2k.inf" tap0901
The location of the batch file is:
c:\TapTest\TapInstall.bat
I want to be able to do the following (using relative paths):
"PsExec.exe" /accepteula -i -s "tapinstall.exe" install "driver\OemWin2k.inf" tap0901
But the tapinstall.exe requires an absolute path as an argument. How can I get the batch file to give the absolute path without hardcoding it?
Solution
"PsExec.exe" /accepteula -i -s "%~dp0tapinstall.exe" install "%~dp0driver\OemWin2k.inf" tap0901
%0
= reference to the current batch file
%~dp0
= drive and path where the batch file is located