Last active
November 5, 2023 01:36
-
-
Save Curtis-64/8e01e465f22c2c3df9cfa7c5d6285bbd to your computer and use it in GitHub Desktop.
Powershell 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
// Powershell Power by Curtis White | |
// lsd directory with indexing | |
// cdx change to index | |
// Caution: Code is prompted AI generated. | |
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