≡ Menu

Find the filesize using PowerShell

Below piece of code helps to find the size of a file that you mention. This code can find the size of a local file, or a file on remote system. You need to give the full path of file to make it work.

$filepath="YOUR FILE PATH"
Get-ChildItem $filepath | ForEach-Object { Write-Host $_.name,==> ($_.Length/1MB).tostring("0.00")MB