Windows command for file size only

后端 未结 12 1921
死守一世寂寞
死守一世寂寞 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:28

    If you are inside a batch script, you can use argument variable tricks to get the filesize:

    filesize.bat:

    @echo off
    echo %~z1
    

    This gives results like the ones you suggest in your question.

    Type

    help call
    

    at the command prompt for all of the crazy variable manipulation options. Also see this article for more information.

    Edit: This only works in Windows 2000 and later

提交回复
热议问题