Hello!This timeCommand to get disk capacityI would like to introduce.
Free disk spaceOnly oneIf you want to confirmOpen explorerJust solve it.
But you have to checkMost Windows machinesIn the case ofTime-consuming workIt will be.
In that case, rather than doing it manuallyBatch file etc.Write the command inDouble click to complete!!If you do likeA lot easierIt will be.
Also, in batches that involve copying files, etc.Check the free disk in advanceYou may want to.In such a case, why not use this command to get free space?
* This time, it will be explained as a command of PowerShell and command prompt. PowerShell commands can also be executed at the command prompt, so in that case we will introduce them together with how to use them.
Get free space on each partition
fsutil is windowsStandard CUI programis.There are many options other than checking the disk capacity.However, if you just want to check the free space, the following command is enough.
fsutil volume diskfree c:
As described belowOutput to text fileOnce you doRecoveryOrSubmit to userI think you can use it to make it work.Output to serverYou can let me do it!
fsutil volume diskfree c:> c: \ c_drive_freesize.txt
This isPowerShell commandsis.Even if this command is executed by itself, it will return information as it is, but if you do the following, unlike the case of fsutil,Free space only valueIt is convenient because it will be returned by. * When embedding a PowerShell command in a batch, you can execute it by adding "@Powershell -command" before the command.
(Get-PSDrive -name C) .free @Powershell -command (Get-PSDrive -name C) .free
This command also has a variety of properties, so if you're interested, check it out!
me tooPowerShell commandsis.This is also the same as Get-PS DriveGet value only necktie with the outfit.
* You can also execute this at the command prompt by adding "@Powershell -command" before the command.
(get-volume C) .SizeRemaining @Powershell -command (get-volume C) .SizeRemaining
Get disk information
As a bonus, in addition to the free disk spaceI want to get detailed informationThis is a command that can be used in cases.
To a WMI objectWin32_DiskDriveHas disc informationobjectExists.
このGet objectBy doing variousGet disc informationcan.
Example) Product name, serial number, etc.
There are many ways to use it, soApplied to various casesI think you can.
Get-WmiObject Win32_DiskDrive | Format-List -Property *
This time on the discFocus on free spaceI introduced the command.
Any command can get various information other than free space, so if you are interested, you should check it out.
As I mentioned in the text, when I want to perform batch processing to copy something, I often use it to check if free space is reserved in advance.Processing is relatively fastFor this reason,Get-PSDriveI often use the ones that use.
In addition to batch processing, you can also register it in a logon script and use it to investigate free space!There are many possibilities for commands, depending on the idea.
I hope it helps you.
★ I posted a usage example.I hope it's a useful reference.