BAT脚本中的相对路径 [英] relative path in BAT script
本文介绍了BAT脚本中的相对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我在USB驱动器上的程序文件夹:
Here is my own program folder on my USB drive:
Program\
run.bat
bin\
config.ini
Iris.exe
library.dll
etc.
我想使用run.bat
来启动Iris.exe
我不能使用它:F:/Program/bin/Iris.exe
就像快捷方式一样,因为有时它不作为驱动器F:
(例如 E:
或G:
)
I cannot use this: F:/Program/bin/Iris.exe
like a shortcut, because sometimes it does not attach as drive F:
(e.g. E:
or G:
)
无论驱动器盘符如何工作,我都需要在bat文件中写什么?
What do I need to write in the bat file to work regardless of the drive letter?
我在BAT文件中尝试过此操作
I tried this in the BAT file:
"\bin\Iris.exe"
但是它不起作用.
推荐答案
在批处理文件中使用它:
Use this in your batch file:
%~dp0\bin\Iris.exe
%~dp0
解析为批处理脚本所在的文件夹的完整路径.
%~dp0
resolves to the full path of the folder in which the batch script resides.
这篇关于BAT脚本中的相对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文