File tree Expand file tree Collapse file tree 3 files changed +27
-22
lines changed Expand file tree Collapse file tree 3 files changed +27
-22
lines changed Original file line number Diff line number Diff line change 11<#
22. SYNOPSIS
3- Sets the working directory to the fonts folder
3+ Sets the working dir to the fonts folder
44. DESCRIPTION
5- This PowerShell script changes the working directory to the fonts folder.
5+ This PowerShell script sets the current working directory to the fonts folder.
66. EXAMPLE
7- PS> ./cd-fonts
8- 📂C:\Windows\Fonts (has 12 fonts and 0 folders)
7+ PS> ./cd-fonts.ps1
8+ 📂C:\Windows\Fonts with 12 font files entered.
99. LINK
1010 https://github.com/fleschutz/PowerShell
1111. NOTES
1919 }
2020 Set-Location " $path "
2121 $files = Get-ChildItem $path - attributes ! Directory
22- $folders = Get-ChildItem $path - attributes Directory
23- " 📂$path entered (has $ ( $files.Count ) fonts and $ ( $folders.Count ) folders)"
22+ " 📂$path with $ ( $files.Count ) font files entered."
2423 exit 0 # success
2524} catch {
2625 " ⚠️ Error: $ ( $Error [0 ]) "
Original file line number Diff line number Diff line change 11<#
22. SYNOPSIS
3- Sets the working directory to the user's pictures folder
3+ Sets the working dir to the user's pictures folder
44. DESCRIPTION
5- This PowerShell script changes the working directory to the user's pictures folder.
5+ This PowerShell script sets the current working directory to the user's pictures folder.
66. EXAMPLE
7- PS> ./cd-pics
8- 📂C:\Users\Markus\Pictures entered (has 7 files and 0 subfolders)
7+ PS> ./cd-pics.ps1
8+ 📂C:\Users\Markus\Pictures with 7 files and 0 folders entered.
99. LINK
1010 https://github.com/fleschutz/PowerShell
1111. NOTES
1414
1515try {
1616 if ($IsLinux ) {
17+ if (-not (Test-Path " ~/Pictures" - pathType container)) {
18+ throw " No 'Pictures' folder in your home directory yet"
19+ }
1720 $path = Resolve-Path " ~/Pictures"
1821 } else {
1922 $path = [Environment ]::GetFolderPath(' MyPictures' )
20- }
21- if ( -not ( Test-Path " $path " - pathType container)) {
22- throw " No pictures folder at $path "
23+ if ( -not ( Test-Path " $path " - pathType container)) {
24+ throw " No pictures folder at: $path "
25+ }
2326 }
2427 Set-Location " $path "
2528 $files = Get-ChildItem $path - attributes ! Directory
2629 $folders = Get-ChildItem $path - attributes Directory
27- " 📂$path entered (has $ ( $files.Count ) files and $ ( $folders.Count ) subfolders) "
30+ " 📂$path with $ ( $files.Count ) files and $ ( $folders.Count ) folders entered. "
2831 exit 0 # success
2932} catch {
3033 " ⚠️ Error: $ ( $Error [0 ]) "
Original file line number Diff line number Diff line change 11<#
22. SYNOPSIS
3- Sets the working directory to the templates folder
3+ Sets the working dir to the templates folder
44. DESCRIPTION
5- This PowerShell script changes the working directory to the templates folder.
5+ This PowerShell script sets the current working directory to the templates folder.
66. EXAMPLE
7- PS> ./cd-templates
8- 📂/home/Markus/Templates entered (has 3 files and 0 subfolders)
7+ PS> ./cd-templates.ps1
8+ 📂/home/Markus/Templates with 3 files and 0 folders entered.
99. LINK
1010 https://github.com/fleschutz/PowerShell
1111. NOTES
1414
1515try {
1616 if ($IsLinux ) {
17+ if (-not (Test-Path " ~/Templates" - pathType container)) {
18+ throw " No 'Templates' folder in your home directory yet"
19+ }
1720 $path = Resolve-Path " ~/Templates"
1821 } else {
1922 $path = [Environment ]::GetFolderPath(' Templates' )
20- }
21- if ( -not ( Test-Path " $path " - pathType container)) {
22- throw " No templates folder at $path "
23+ if ( -not ( Test-Path " $path " - pathType container)) {
24+ throw " No templates folder at: $path "
25+ }
2326 }
2427 Set-Location " $path "
2528 $files = Get-ChildItem $path - attributes ! Directory
2629 $folders = Get-ChildItem $path - attributes Directory
27- " 📂$path entered (has $ ( $files.Count ) files and $ ( $folders.Count ) subfolders) "
30+ " 📂$path with $ ( $files.Count ) files and $ ( $folders.Count ) folders entered. "
2831 exit 0 # success
2932} catch {
3033 " ⚠️ Error: $ ( $Error [0 ]) "
You can’t perform that action at this time.
0 commit comments