Windows command for file size only

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

    If you don't want to do this in a batch script, you can do this from the command line like this:

    for %I in (test.jpg) do @echo %~zI
    

    Ugly, but it works. You can also pass in a file mask to get a listing for more than one file:

    for %I in (*.doc) do @echo %~znI
    

    Will display the size, file name of each .DOC file.

提交回复
热议问题