Windows Batchfile can have%0-%9 parameters, where%0 defaults to the full path of Batchfile,%1-%9 to the incoming parameters of the user.
The following special tags can be used to obtain the properties of a file, and if you use a special tag for%0 to obtain the related properties of Batachfile, if a%* is a path to a file in%1-%9, you can also use the following special tag to obtain the related properties of the%* representation file.
For example: D:\testfolder\test.bat
Copy Code code as follows:
echo off
Echo Path name:
Echo%1
Echo Fully qualified path name:
Echo%~F1
Echo dirive:
Echo%~d1
Echo Path:
Echo%~P1
Echo Name:
Echo%~n1
echo extention:
Echo%~x1
echo Short Name:
Echo%~S1
echo attribute:
Echo%~A1
Echo Time:
Echo%~t1
Echo Size:
Echo%~Z1
Echo Directory:
Echo%~DP1
The call is D:\testfolder\test.bat "C:\test\new folder\mytable.txt" and the output is as follows:
Copy Code code as follows:
D:\>echo off
Path name:
"C:\test\new Folder\mytable.txt"
Fully qualified path name:
C:\test\New Folder\mytable.txt
Dirive:
C:
Path
\test\new Folder\
Name
MyTable
Extention:
. txt
Short name:
C:\test\newfol~1\mytable.txt
Attribute
--A------
Time
2010-09-27 15:01
Size
Directory
C:\test\New Folder\