PowerShell 計算檔案數量和程式碼行數

計算檔案數量:
    
(Get-ChildItem -File -Recurse -Force | Measure-Object).Count
    

範例輸出:
    
(Get-ChildItem -File -Recurse -Force | Measure-Object).Count
345
    

計算程式碼行數:
    
Get-ChildItem -Recurse -Include *.* | Get-Content | Measure-Object -Line
    

範例輸出:
    
Get-ChildItem -Recurse -Include *.* | Get-Content | Measure-Object -Line

Lines Words Characters Property
----- ----- ---------- --------
21685
    

留言