我有以下批处理文件:
"C:\TapTest\PsExec.exe" /accepteula -i -s "C:\TapTest\tapinstall.exe"
-> install "C:\TapTest\driver\OemWin2k.inf" tap0901
批处理文件的位置是:
c:\TapTest\TapInstall.bat
我希望能够执行以下操作(使用相对路径):
"PsExec.exe" /accepteula -i -s "tapinstall.exe" install "driver\OemWin2k.inf" tap0901
但是tapinstall.exe需要绝对路径作为参数。如何在不进行硬编码的情况下获取批处理文件以提供绝对路径?
"PsExec.exe" /accepteula -i -s "%~dp0tapinstall.exe" install "%~dp0driver\OemWin2k.inf" tap0901
%0
=引用当前的批处理文件
%~dp0
=批处理文件所在的驱动器和路径
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句