-2

Thanx in advance

I want to create a batch script using which I get all the drives used space, available space, and total space and store it in to the table.

Please help me. i found fsutil command but failed to retrieve result.

Hima Joshi
  • 11
  • 3
  • 3
    You should not include 'thanks' in posts. See this meta post: [Should 'Hi', 'thanks', taglines, and salutations be removed from posts?](https://meta.stackexchange.com/q/2950) – user202729 Jul 26 '18 at 14:34
  • 2
    Well what have you tried so far? Please try to create a [mcve]. – Paxz Jul 26 '18 at 15:05
  • use `Powershell -Nop -C "Get-Volume|? DriveType -eq Fixed|sort DriveLetter"` –  Jul 26 '18 at 15:19
  • 1
    Try `wmic LogicalDisk get` or `wmic Volume get`... – aschipfl Jul 26 '18 at 16:36
  • Please note that https://stackoverflow.com is not a free script/code writing service. If you tell us what you have tried so far (include the scripts/code you are already using) and where you are stuck then we can try to help with specific problems. You should also read [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask). – DavidPostill Jul 29 '18 at 11:54

1 Answers1

0

Save this as a batch file, and double-click it, your information should be written to CSV along side it.

<!-- :
@(Echo Drive,Size[GB],Used[GB],Available[GB]
    @CScript //NoLogo "%~f0?.wsf")>"MyDriveInfo.csv"
@Exit /B
-->
<Job><Script Language="VBScript">
Set o=CreateObject("Scripting.FileSystemObject")
For Each oD In o.Drives:If oD.IsReady=True Then
  Wscript.Echo oD.DriveLetter & ":," &_
  Round(oD.TotalSize/1073741824,2) & "," &_
  Round((oD.TotalSize-oD.FreeSpace)/1073741824,2) & "," &_
  Round(oD.AvailableSpace/1073741824,2)
Else:Wscript.Echo oD.DriveLetter & ":,,,":End If:Next
</Script></Job>
Compo
  • 36,585
  • 5
  • 27
  • 39