$process = Get-Process
$process | where-object {$_.cpu -gt 100}
$process = Get-Process
$process | Sort-Object WorkingSet64 -Descending
$total = $true
PS C:\Users\bob\ps> [int]$num1 = '2'
[int]$num2 = '3'
$num1+$num2
5
$total.tostring()
PS C:\Users\bob\ps> $var1 = 'two plus one equals: $(1 + 2)'
$var1
two plus one equals: $(1 + 2)
PS C:\Users\bob\ps> $var2 = "two plus one equals: $(1 + 2)"
$var2
two plus one equals: 3
Get-Variable
Get-ChildItem env:
$env:COMPUTERNAME
PS C:\Users\bob\ps> $path = Read-Host -Prompt 'please enter the file path to scan for large files'
please enter the file path to scan for large files: C:\Users\bob\ionic-react-here\build
PS C:\Users\bob\ps> $rawFileData = Get-ChildItem -Path $path -Recurse
$largeFiles = $rawFileData | Where-Object {$_.Length -gt 0.1MB}
$largeFilesCount = $largeFiles | Measure-Object | Select-Object -ExpandProperty Count
Write-Host "There are $largeFilesCount large files(s) in $path"
There are 8 large files(s) in C:\Users\bob\ionic-react-here\build
reference:
https://www.youtube.com/watch?v=4Rc0aEMXiWw
No comments:
Post a Comment