본문 바로가기
  • A space that records me :)
Language/OS Script

[bat] 디스크 용량 로그 출력

by yjkim_97 2021. 4. 2.
@echo off

:: C drive format_table
PowerShell "Get-WmiObject win32_logicaldisk -filter """DeviceID='c:'""" | FT DeviceID, @{Name='DiskSize (GB)'; E={\"{0:N1} GB\" -F($_.Size/1GB)}}, @{Name='FreeSpace (GB)'; E={\"{0:N1} GB\" -F($_.freespace/1GB)}}"

:: C drive Size
PowerShell "$size=(Get-WmiObject win32_logicaldisk -filter """DeviceID='c:'""").Size; [math]::Round($size/1GB, 2).toString();"

:: C drive freespace
PowerShell "$size=(Get-WmiObject win32_logicaldisk -filter """DeviceID='c:'""").freespace; [math]::Round($size/1GB, 2).toString();"

 

'Language > OS Script' 카테고리의 다른 글

[bat] 오래된 파일 삭제  (0) 2021.04.02
[bat] 날짜 계산 (오늘 기준 -n일)  (0) 2021.04.02