如何在同一目录作为Windows批处理文件来执行的程序? [英] How to execute programs in the same directory as the windows batch file?
本文介绍了如何在同一目录作为Windows批处理文件来执行的程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在同一个文件夹的.bat
和 .exe文件
文件。
我不能调用从的.bat
的 .exe文件
文件,除非我把完整的绝对路径。
有没有一种方法,以不指定路径?
I have in the same folder a .bat
and a .exe
file.
I couldn't call the .exe
file from the .bat
unless I put the full absolute path to it.
Is there a way to don't specify the path?
推荐答案
尝试调用 .exe文件
与%〜DP0
,就像这样:%〜dp0MyProgram.exe
Try calling the .exe
with %~dp0
, like this: %~dp0MyProgram.exe
.
0%
包含完整路径名为的.bat
文件。
%0
contains the full path to the called .bat
file.
〜DP
表示获取驱动器和路径,包括末尾 \\
。
~dp
says to get the drive and path, including trailing \
.
这篇关于如何在同一目录作为Windows批处理文件来执行的程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文