سؤال

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?

هل كانت مفيدة؟

المحلول

"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


مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top