File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 11<#
22. SYNOPSIS
3- Sets the working directory to the users directory
3+ Sets the working dir to the users directory
44. DESCRIPTION
5- This PowerShell script changes the working directory to the users directory.
5+ This PowerShell script sets the current working directory to the users directory.
66. EXAMPLE
7- PS> ./cd-users
8- 📂C:\Users entered (has 0 files and 4 subfolders)
7+ PS> ./cd-users.ps1
8+ 📂C:\Users with 4 folders entered.
99. LINK
1010 https://github.com/fleschutz/PowerShell
1111. NOTES
1515try {
1616 $path = Resolve-Path " ~/.."
1717 if (-not (Test-Path " $path " - pathType container)) {
18- throw " No users directory at $path "
18+ throw " No users directory at: $path "
1919 }
2020 Set-Location " $path "
21- $files = Get-ChildItem $path - attributes ! Directory
2221 $folders = Get-ChildItem $path - attributes Directory
23- " 📂$path entered (has $ ( $files .Count ) files and $ ( $ folders.Count ) subfolders) "
22+ " 📂$path with $ ( $folders .Count ) folders entered. "
2423 exit 0 # success
2524} catch {
2625 " ⚠️ Error: $ ( $Error [0 ]) "
You can’t perform that action at this time.
0 commit comments