Explanation of variable with ~ syntax
Posted on 2011-02-25
I got this batch script on the web for listing files with their sizes and there is one part I do not fully understand, so I was hoping someone could explain it to me
set /A Total=0, Cnt=0
for /F "tokens=*" %%A in ('dir %1 /S /B /A-D') do call :show "%%A"
set "Size= %~z1"
echo %~f1 %~t1 %Size:~-10% >> c:\test\files.txt
The part I don't understand is in the 3rd last line of the script:
Is the whole variable everything between the two % characters?
I understand that the %Size is the Size variable which is set to the file size in the previous line, but I don't understand what the :~10% bit is doing - so please advise