Free space in a CMD shell

后端 未结 9 1840
北海茫月
北海茫月 2020-12-02 10:04

Is there a way to get the amount of free diskspace of a disk or a folder in a CMD without having to install some thirdparty applications?

I have a CMD that copies a

9条回答
  •  一生所求
    2020-12-02 10:43

    df.exe

    Shows all your disks; total, used and free capacity. You can alter the output by various command-line options.

    You can get it from http://www.paulsadowski.com/WSH/cmdprogs.htm, http://unxutils.sourceforge.net/ or somewhere else. It's a standard unix-util like du.

    df -h will show all your drive's used and available disk space. For example:

    M:\>df -h
    Filesystem      Size  Used Avail Use% Mounted on
    C:/cygwin/bin   932G   78G  855G   9% /usr/bin
    C:/cygwin/lib   932G   78G  855G   9% /usr/lib
    C:/cygwin       932G   78G  855G   9% /
    C:              932G   78G  855G   9% /cygdrive/c
    E:              1.9T  1.3T  621G  67% /cygdrive/e
    F:              1.9T  201G  1.7T  11% /cygdrive/f
    H:              1.5T  524G  938G  36% /cygdrive/h
    M:              1.5T  524G  938G  36% /cygdrive/m
    P:               98G   67G   31G  69% /cygdrive/p
    R:               98G   14G   84G  15% /cygdrive/r
    

    Cygwin is available for free from: https://www.cygwin.com/ It adds many powerful tools to the command prompt. To get just the available space on drive M (as mapped in windows to a shared drive), one could enter in:

    M:\>df -h | grep M: | awk '{print $4}'
    

提交回复
热议问题