作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我知道 %0
包含批处理脚本的完整路径,例如c:\path\to\my\file\abc.bat
我希望 path
等于 c:\path\to\my\file
我怎样才能做到这一点?
最佳答案
%~dp0
将是目录。 Here's some documentation on all of the path modifiers .有趣的东西:-)
要删除最后的反斜杠,您可以使用 :n,m
子字符串语法,如下所示:
SET mypath=%~dp0
echo %mypath:~0,-1%
不幸的是,我认为没有办法将 %0
语法与 :~n,m
语法结合起来。
关于windows - 如何在 Windows 中获取批处理脚本的路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3827567/
我是一名优秀的程序员,十分优秀!