Windows command for file size only

后端 未结 12 1970
死守一世寂寞
死守一世寂寞 2020-11-27 16:12

Is there a Windows command that will output the size in bytes of a specified file like this?

> filesize test.jpg
65212

I know that the d

12条回答
  •  忘掉有多难
    2020-11-27 16:35

    Use a function to get rid off some limitation in the ~z operator. It is especially useful with a for loop:

    @echo off
    set size=0
    call :filesize "C:\backup\20120714-0035\error.log"
    echo file size is %size%
    goto :eof
    
    :: Set filesize of first argument in %size% variable, and return
    :filesize
      set size=%~z1
      exit /b 0
    

提交回复
热议问题