加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

如何从脚本本身获取Windows .bat脚本的名称?

发布时间:2020-12-13 23:21:45 所属栏目:Windows 来源:网络整理
导读:我有一个.bat文件.我想以编程方式获取.bat文件的名称.我怎样才能做到这一点? 这是我的最终目标 "..libnantnant.exe" -buildfile:nant.build {{pass in name of this file here}}pause 试试/?在命令行上.帮助显示各种有用的文件名替换,例如: %~I - expa
我有一个.bat文件.我想以编程方式获取.bat文件的名称.我怎样才能做到这一点?

这是我的最终目标

"..libnantnant.exe" -buildfile:nant.build {{pass in name of this file here}}
pause
试试/?在命令行上.帮助显示各种有用的文件名替换,例如:
%~I         - expands %I removing any surrounding quotes (")
%~fI        - expands %I to a fully qualified path name
%~dI        - expands %I to a drive letter only
%~pI        - expands %I to a path only
%~nI        - expands %I to a file name only
%~xI        - expands %I to a file extension only

将I替换为0以获取批处理文件名,并将I替换为1,2,3等以获取参数名称.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读