在Windows批处理文件中,%~d0代表什么意思?
在Windows批处理文件中,%~d0代表什么意思?
我正在查看一个批处理文件,其中定义了以下变量:
set _SCRIPT_DRIVE=%~d0 set _SCRIPT_PATH=%~p0
%~d0
或%~p0
实际上是什么意思?- 是否有一组众所周知的值,例如当前目录、驱动器、脚本参数?
- 是否还有其他类似的快捷方式可供使用?
admin 更改状态以发布 2023年5月22日
它们是增强的变量替换。它们修改批处理文件中使用的%N变量。如果您正在Windows中进行批处理编程,那么非常有用。
%~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 %~sI - expanded path contains short names only %~aI - expands %I to file attributes of file %~tI - expands %I to date/time of file %~zI - expands %I to size of file %~$PATH:I - searches the directories listed in the PATH environment variable and expands %I to the fully qualified name of the first one found. If the environment variable name is not defined or the file is not found by the search, then this modifier expands to the empty string
您可以通过运行FOR /?
来找到上面提到的内容。