8 tips for setting up PowerShell on Windows

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • fd

    A simple, fast and user-friendly alternative to 'find'

  • # To make ZLocation module work in every PowerShell instance. Import-Module ZLocation # PSFzf has undocumented option to use fd executable for # file and directory searching. This enables that option. Set-PsFzfOption -EnableFd:$true # Custom function to SetLocation, because PSFzf uses # Get-ChildItem which doesn't use fd and doesn't use # ignore files. Invoke-FuzzySetLocation is defined here # https://github.com/kelleyma49/PSFzf/blob/b97263a30addd9a2c84a8603382c92e4e6de0eeb/PSFzf.Functions.ps1#L142 # # This implementation is for setting FileSystem location # and implementation uses parts of # https://github.com/kelleyma49/PSFzf/blob/b97263a30addd9a2c84a8603382c92e4e6de0eeb/PSFzf.Base.ps1#L20 # https://github.com/kelleyma49/PSFzf/blob/b97263a30addd9a2c84a8603382c92e4e6de0eeb/PSFzf.Base.ps1#L35 function Invoke-FuzzySetLocation2() { param($Directory = $null) if ($null -eq $Directory) { $Directory = $PWD.Path } $result = $null try { # Color output from fd to fzf if running in Windows Terminal $script:RunningInWindowsTerminal = [bool]($env:WT_Session) if ($script:RunningInWindowsTerminal) { $script:DefaultFileSystemFdCmd = "fd.exe --color always . {0}" } else { $script:DefaultFileSystemFdCmd = "fd.exe . {0}" } # Wrap $Directory in quotes if there is space (to be passed in fd) if ($Directory.Contains(' ')) { $strDir = """$Directory""" } else { $strDir = $Directory } # Call fd to get directory list and pass to fzf Invoke-Expression (($script:DefaultFileSystemFdCmd -f '--type directory {0} --max-depth 1') -f $strDir) | Invoke-Fzf | ForEach-Object { $result = $_ } } catch { } if ($null -ne $result) { Set-Location $result } } # Show tips about newly added commands function Get-Tips { $tips = @( [pscustomobject]@{ Command = 'fcd' Description = 'navigate to subdirectory' }, [pscustomobject]@{ Command = 'ALT+C' Description = 'navigate to deep subdirectory' }, [pscustomobject]@{ Command = 'z' Description = 'ZLocation' }, [pscustomobject]@{ Command = 'fz' Description = 'ZLocation through fzf' }, [pscustomobject]@{ Command = 'fe' Description = 'fuzzy edit file' }, [pscustomobject]@{ Command = 'fh' Description = 'fuzzy invoke command from history' }, [pscustomobject]@{ Command = 'fkill' Description = 'fuzzy stop process' }, [pscustomobject]@{ Command = 'fd' Description = 'find https://github.com/sharkdp/fd#how-to-use' }, [pscustomobject]@{ Command = 'rg' Description = 'find in files https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md' } ) Write-Output $tips | Format-Table } # Define aliases to call fuzzy methods from PSFzf New-Alias -Scope Global -Name fcd -Value Invoke-FuzzySetLocation2 -ErrorAction Ignore New-Alias -Scope Global -Name fe -Value Invoke-FuzzyEdit -ErrorAction Ignore New-Alias -Scope Global -Name fh -Value Invoke-FuzzyHistory -ErrorAction Ignore New-Alias -Scope Global -Name fkill -Value Invoke-FuzzyKillProcess -ErrorAction Ignore New-Alias -Scope Global -Name fz -Value Invoke-FuzzyZLocation -ErrorAction Ignore

  • fzf

    :cherry_blossom: A command-line fuzzy finder

  • fzf is super fast fuzzy filter/finder. It launches interactive finder with results that are piped into it and will write selected item to STDOUT. If not used with pipe, fzf will get the list of files (using find).

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • lazygit

    simple terminal UI for git commands

  • lazygit is awesome terminal UI for git. It helps with git commands by offering simple UI, menu, interactive rebase, recent branches, scrolling through logs and diffs.

  • ripgrep

    ripgrep recursively searches directories for a regex pattern while respecting your gitignore

  • # To make ZLocation module work in every PowerShell instance. Import-Module ZLocation # PSFzf has undocumented option to use fd executable for # file and directory searching. This enables that option. Set-PsFzfOption -EnableFd:$true # Custom function to SetLocation, because PSFzf uses # Get-ChildItem which doesn't use fd and doesn't use # ignore files. Invoke-FuzzySetLocation is defined here # https://github.com/kelleyma49/PSFzf/blob/b97263a30addd9a2c84a8603382c92e4e6de0eeb/PSFzf.Functions.ps1#L142 # # This implementation is for setting FileSystem location # and implementation uses parts of # https://github.com/kelleyma49/PSFzf/blob/b97263a30addd9a2c84a8603382c92e4e6de0eeb/PSFzf.Base.ps1#L20 # https://github.com/kelleyma49/PSFzf/blob/b97263a30addd9a2c84a8603382c92e4e6de0eeb/PSFzf.Base.ps1#L35 function Invoke-FuzzySetLocation2() { param($Directory = $null) if ($null -eq $Directory) { $Directory = $PWD.Path } $result = $null try { # Color output from fd to fzf if running in Windows Terminal $script:RunningInWindowsTerminal = [bool]($env:WT_Session) if ($script:RunningInWindowsTerminal) { $script:DefaultFileSystemFdCmd = "fd.exe --color always . {0}" } else { $script:DefaultFileSystemFdCmd = "fd.exe . {0}" } # Wrap $Directory in quotes if there is space (to be passed in fd) if ($Directory.Contains(' ')) { $strDir = """$Directory""" } else { $strDir = $Directory } # Call fd to get directory list and pass to fzf Invoke-Expression (($script:DefaultFileSystemFdCmd -f '--type directory {0} --max-depth 1') -f $strDir) | Invoke-Fzf | ForEach-Object { $result = $_ } } catch { } if ($null -ne $result) { Set-Location $result } } # Show tips about newly added commands function Get-Tips { $tips = @( [pscustomobject]@{ Command = 'fcd' Description = 'navigate to subdirectory' }, [pscustomobject]@{ Command = 'ALT+C' Description = 'navigate to deep subdirectory' }, [pscustomobject]@{ Command = 'z' Description = 'ZLocation' }, [pscustomobject]@{ Command = 'fz' Description = 'ZLocation through fzf' }, [pscustomobject]@{ Command = 'fe' Description = 'fuzzy edit file' }, [pscustomobject]@{ Command = 'fh' Description = 'fuzzy invoke command from history' }, [pscustomobject]@{ Command = 'fkill' Description = 'fuzzy stop process' }, [pscustomobject]@{ Command = 'fd' Description = 'find https://github.com/sharkdp/fd#how-to-use' }, [pscustomobject]@{ Command = 'rg' Description = 'find in files https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md' } ) Write-Output $tips | Format-Table } # Define aliases to call fuzzy methods from PSFzf New-Alias -Scope Global -Name fcd -Value Invoke-FuzzySetLocation2 -ErrorAction Ignore New-Alias -Scope Global -Name fe -Value Invoke-FuzzyEdit -ErrorAction Ignore New-Alias -Scope Global -Name fh -Value Invoke-FuzzyHistory -ErrorAction Ignore New-Alias -Scope Global -Name fkill -Value Invoke-FuzzyKillProcess -ErrorAction Ignore New-Alias -Scope Global -Name fz -Value Invoke-FuzzyZLocation -ErrorAction Ignore

  • ZLocation

    ZLocation is the new Jump-Location

  • ZLocation remembers directories you often navigate and rank them. After some time it will allow you to jump around with few letters. You can provide more letters (or regex) to narrow the search.

  • PSFzf

    A PowerShell wrapper around the fuzzy finder fzf

  • # To make ZLocation module work in every PowerShell instance. Import-Module ZLocation # PSFzf has undocumented option to use fd executable for # file and directory searching. This enables that option. Set-PsFzfOption -EnableFd:$true # Custom function to SetLocation, because PSFzf uses # Get-ChildItem which doesn't use fd and doesn't use # ignore files. Invoke-FuzzySetLocation is defined here # https://github.com/kelleyma49/PSFzf/blob/b97263a30addd9a2c84a8603382c92e4e6de0eeb/PSFzf.Functions.ps1#L142 # # This implementation is for setting FileSystem location # and implementation uses parts of # https://github.com/kelleyma49/PSFzf/blob/b97263a30addd9a2c84a8603382c92e4e6de0eeb/PSFzf.Base.ps1#L20 # https://github.com/kelleyma49/PSFzf/blob/b97263a30addd9a2c84a8603382c92e4e6de0eeb/PSFzf.Base.ps1#L35 function Invoke-FuzzySetLocation2() { param($Directory = $null) if ($null -eq $Directory) { $Directory = $PWD.Path } $result = $null try { # Color output from fd to fzf if running in Windows Terminal $script:RunningInWindowsTerminal = [bool]($env:WT_Session) if ($script:RunningInWindowsTerminal) { $script:DefaultFileSystemFdCmd = "fd.exe --color always . {0}" } else { $script:DefaultFileSystemFdCmd = "fd.exe . {0}" } # Wrap $Directory in quotes if there is space (to be passed in fd) if ($Directory.Contains(' ')) { $strDir = """$Directory""" } else { $strDir = $Directory } # Call fd to get directory list and pass to fzf Invoke-Expression (($script:DefaultFileSystemFdCmd -f '--type directory {0} --max-depth 1') -f $strDir) | Invoke-Fzf | ForEach-Object { $result = $_ } } catch { } if ($null -ne $result) { Set-Location $result } } # Show tips about newly added commands function Get-Tips { $tips = @( [pscustomobject]@{ Command = 'fcd' Description = 'navigate to subdirectory' }, [pscustomobject]@{ Command = 'ALT+C' Description = 'navigate to deep subdirectory' }, [pscustomobject]@{ Command = 'z' Description = 'ZLocation' }, [pscustomobject]@{ Command = 'fz' Description = 'ZLocation through fzf' }, [pscustomobject]@{ Command = 'fe' Description = 'fuzzy edit file' }, [pscustomobject]@{ Command = 'fh' Description = 'fuzzy invoke command from history' }, [pscustomobject]@{ Command = 'fkill' Description = 'fuzzy stop process' }, [pscustomobject]@{ Command = 'fd' Description = 'find https://github.com/sharkdp/fd#how-to-use' }, [pscustomobject]@{ Command = 'rg' Description = 'find in files https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md' } ) Write-Output $tips | Format-Table } # Define aliases to call fuzzy methods from PSFzf New-Alias -Scope Global -Name fcd -Value Invoke-FuzzySetLocation2 -ErrorAction Ignore New-Alias -Scope Global -Name fe -Value Invoke-FuzzyEdit -ErrorAction Ignore New-Alias -Scope Global -Name fh -Value Invoke-FuzzyHistory -ErrorAction Ignore New-Alias -Scope Global -Name fkill -Value Invoke-FuzzyKillProcess -ErrorAction Ignore New-Alias -Scope Global -Name fz -Value Invoke-FuzzyZLocation -ErrorAction Ignore

  • Scoop

    A command-line installer for Windows.

  • Scoop is awesome tool to get started with. It can be viewed as alternative to Chocolatey, however Scoop is more oriented towards developer command line tools and their installation process.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • Chocolatey

    Chocolatey - the package manager for Windows

  • Scoop is awesome tool to get started with. It can be viewed as alternative to Chocolatey, however Scoop is more oriented towards developer command line tools and their installation process.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts