码迷,mamicode.com
首页 > 其他好文 > 详细

bat 获取文件名称,路径,属性.....

时间:2020-11-21 12:05:00      阅读:6      评论:0      收藏:0      [点我收藏+]

标签:mod   arch   round   $path   list   获取文件   名称   expand   off   

:: %~1 - expands %1 removing any surrounding quotes (")
:: %~f1 - expands %1 to a fully qualified path name
:: %~d1 - expands %1 to a drive letter only
:: %~p1 - expands %1 to a path only
:: %~n1 - expands %1 to a file name only
:: %~x1 - expands %1 to a file extension only
:: %~s1 - expanded path contains short names only
:: %~a1 - expands %1 to file attributes
:: %~t1 - expands %1 to date/time of file
:: %~z1 - expands %1 to size of file
:: %~$PATH:1 - searches the directories listed in the PATH
:: environment variable and expands %1 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
@echo off
echo %~1
echo %~f1
echo %~d1
echo %~p1
echo %~n1
echo %~x1
echo %~s1
echo %~a1
echo %~t1
echo %~z1
echo %~$PATH:1
pause

将文件拖入bat中,看打印输出....

bat 获取文件名称,路径,属性.....

标签:mod   arch   round   $path   list   获取文件   名称   expand   off   

原文地址:https://www.cnblogs.com/greyorbit/p/13992880.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!