Skip to content

Use powershell for default command on Windows #960

@janlazo

Description

@janlazo
  • Category
    • fzf binary
    • fzf-tmux script
    • Key bindings
    • Completion
    • Vim
    • Neovim
    • Etc.
  • OS
    • Linux
    • Mac OS X
    • Windows
    • Windows Subsystem for Linux
    • Etc.
  • Shell
    • bash
    • zsh
    • fish

dir /s/b does not filter hidden directories/files and its results cannot be piped to another dir command.
I can't get dir /b/a:-d-h | dir /s/b to work in cmd.exe to filter hidden directories before recursing on subfolders.

Powershell does not have these issues because of object piping and output customization.
The following command works in cmd.exe and runs powershell on default settings to recursively get all non-hidden files. This takes up more time but removes files in hidden directories such as .git. Additional parameters are added to the powershell.exe to reduce the startup time.

powershell.exe -NoLogo -NoProfile -Noninteractive -Command "Get-ChildItem -File -Recurse | ForEach-Object {echo $_.FullName}"

Edit:
Get-ChildItem supports -Name for relative path so object piping is not required.

powershell.exe -NoLogo -NoProfile -Noninteractive -Command "Get-ChildItem -File -Recurse -Name"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions