Count items in a folder with PowerShell

后端 未结 7 1373
闹比i
闹比i 2020-12-01 04:10

I\'m trying to write a very simple PowerShell script to give me the total number of items (both files and folders) in a given folder (c:\\MyFolder). Here\'s wh

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-01 04:28

    In powershell you can to use severals commands, for looking for this commands digit: Get-Alias;

    So the cammands the can to use are:

    write-host (ls MydirectoryName).Count
    

    or

    write-host (dir MydirectoryName).Count
    

    or

    write-host (Get-ChildrenItem MydirectoryName).Count
    

提交回复
热议问题