mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-09 21:07:40 +02:00
Updated some scripts
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
This PowerShell script changes the working directory to the folder for Git repositories.
|
||||
.EXAMPLE
|
||||
PS> ./cd-repos.ps1
|
||||
📂C:\Repos (has 33 subfolders)
|
||||
📂C:\Repos with 33 folders entered.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -23,13 +23,11 @@ try {
|
||||
} elseif (Test-Path "/repositories" -pathType container) { $path = "/repositories"
|
||||
} elseif (Test-Path "~/source/repos" -pathType container) { $path = "~/source/repos" # Visual Studio default
|
||||
} elseif (Test-Path "D:/Repos" -pathType container) { $path = "D:/Repos" # second HDD
|
||||
} else {
|
||||
throw "No folder found for Git repositories (in home or root directory) - Please create one."
|
||||
}
|
||||
} else { throw "Found no folder for Git repositories (in home or root directory) - Please create one." }
|
||||
$path = Resolve-Path $path
|
||||
Set-Location "$path"
|
||||
$subfolders = Get-ChildItem $path -attributes Directory
|
||||
"📂$path entered (has $($subfolders.Count) subfolders)"
|
||||
$folders = Get-ChildItem $path -attributes Directory
|
||||
"📂$path with $($folders.Count) folders entered."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
|
Reference in New Issue
Block a user