How do I do 'dir /s /b' in PowerShell?

后端 未结 7 583
梦毁少年i
梦毁少年i 2020-12-23 19:34

I have a folder with three files and want the equivalent of dir /s /b in PowerShell. How do I do that?

For example, if the folder name is temp3

7条回答
  •  别那么骄傲
    2020-12-23 20:13

    Just to enforce, what Joey said:

    gci -r -filter *.log | % fullname
    

    This works to find files like dir /s/b *.log does.


    (dir -r *.log).FullName works as well


    Execute this once in your powershell shell, to enable a dirsb *.log command:

    function global:dirsb {
        param ([Parameter(Mandatory=$true)][string]$fileFilter)
        gci -r -filter $fileFilter | % fullname
    }
    

    or add it to your profile: PS> notepad $profile

提交回复
热议问题