Windows command for file size only

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

    Try forfiles:

    forfiles /p C:\Temp /m file1.txt /c "cmd /c echo @fsize"
    

    The forfiles command runs command c for each file m in directory p.

    The variable @fsize is replaced with the size of each file.

    If the file C:\Temp\file1.txt is 27 bytes, forfiles runs this command:

    cmd /c echo 27
    

    Which prints 27 to the screen.

    As a side-effect, it clears your screen as if you had run the cls command.

提交回复
热议问题