Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
Script:
# Script to view folder size in Windows
param (
[string]$folderPath = "C:\Path\To\Your\Folder"
)
function Get-FolderSize {
param (
[string]$path
)
if (-Not (Test-Path $path)) {
Write-Host "The specified path does not exist."
return
}
$folderSize = Get-ChildItem -Path $path -Recurse -ErrorAction SilentlyContinue |
Measure-Object -Property Length -Sum
$sizeInMB = [math]::Round($folderSize.Sum / 1MB, 2)
Write-Host "The size of the folder is $sizeInMB MB"
}
Get-FolderSize -path $folderPath
Como Executar o Script:
.ps1
, por exemplo, ViewFolderSize.ps1
.cd
..\ViewFolderSize.ps1 -folderPath "C:\Path\To\Your\Folder"
(substitua "C:\Path\To\Your\Folder"
pelo caminho da pasta que deseja verificar).