DOS 批处理获取文件大小

最近研究了几天,终于写了出来.特别分享.

 
  

@echo off&setlocal enabledelayedexpansion set "fn=E:\cheleon\data\localdb.mdb"

set /a "k=0"

for /f "skip=4 delims=" %%t in ('dir /-c %fn%') do (

 set str=%%t  set /a "k=k+1"  if !k! GEQ 1 goto LN  

)

:LN

for /f "tokens=1-10 delims=/-: " %%o in ("%str%") do (

    set /a w1=%%t/1024  

)

echo filesiza:!w1!KB  

你可能感兴趣的:(Linux运维)