Created
August 31, 2023 02:23
-
-
Save CurtisAccelerate/02d1b68a8cc8d1fa8c091d4ec1ad20b5 to your computer and use it in GitHub Desktop.
Powershell Ultimate Power
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// lsd directory with indexing | |
// cdx change to index | |
function Set-IndexedLocation { | |
param( | |
[int]$index | |
) | |
$dir = (Get-ChildItem -Directory)[$index - 1].FullName | |
if ($dir) { | |
Set-Location $dir | |
} else { | |
Write-Host "Invalid index" | |
} | |
} | |
Set-Alias -Name cdx -Value Set-IndexedLocation | |
function lsd { | |
$directories = Get-ChildItem -Directory | |
for ($i = 0; $i -lt $directories.Count; $i++) { | |
Write-Host ("{0}: {1}" -f ($i + 1), $directories[$i].Name) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment