Windows批处理文件可以自行决定其文件名? [英] Can a Windows batch file determine its own file name?
本文介绍了Windows批处理文件可以自行决定其文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可以在Windows批处理文件确定自己的文件名?
Can a Windows batch file determine its own file name?
例如,如果我运行批处理文件C:\\ TEMP \\ myScript.bat,有myScript.bat中的命令,可用于确定字符串myScript.bat
For example, if I run the batch file C:\Temp\myScript.bat, is there a command within myScript.bat that can determine the string "myScript.bat"?
推荐答案
是的。结果
使用专用 0%
变量来获取路径到当前文件。结果
写%〜N0
来得到公正的文件名部分。
Yes.
Use the special %0
variable to get the path to the current file.
Write %~n0
to get just the filename part.
这篇关于Windows批处理文件可以自行决定其文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文