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

前端之家收集整理的这篇文章主要介绍了如何从脚本本身获取Windows .bat脚本的名称?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个.bat文件.我想以编程方式获取.bat文件名称.我怎样才能做到这一点?

这是我的最终目标

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

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

猜你在找的Windows相关文章