Compare commits

..

No commits in common. "main" and "v1.5" have entirely different histories.
main ... v1.5

686 changed files with 1136 additions and 1834 deletions

View File

@ -1,5 +1,5 @@
Headline Your Headline
======== =============
Some introductory words... Some introductory words...

View File

@ -1,5 +1,5 @@
Headline Your Headline
======== =============
Some introductory words... Some introductory words...

View File

@ -116,4 +116,4 @@ try {
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:33)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -72,4 +72,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:33)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -1,8 +1,7 @@
The *build-repo.ps1* Script The *build-repo.ps1* Script
=========================== ===========================
This PowerShell script builds a Git repository by supporting the following build This PowerShell script builds a Git repository by supporting the build systems: autogen, cmake, configure, Gradle, Imakefile, Makefile, and Meson.
systems: autogen, cargo, cmake, configure, Gradle, Imakefile, Makefile, and Meson.
Parameters Parameters
---------- ----------
@ -10,7 +9,7 @@ Parameters
/Repos/PowerShell/scripts/build-repo.ps1 [[-path] <String>] [<CommonParameters>] /Repos/PowerShell/scripts/build-repo.ps1 [[-path] <String>] [<CommonParameters>]
-path <String> -path <String>
Specifies the file path to the Git repository (default: current working directory) Specifies the path to the Git repository (current working directory by default)
Required? false Required? false
Position? 1 Position? 1
@ -30,7 +29,7 @@ Example
PS> ./build-repo.ps1 C:\Repos\ninja PS> ./build-repo.ps1 C:\Repos\ninja
⏳ Building 📂ninja by using CMake... ⏳ Building 📂ninja by using CMake...
... ...
✅ Build of 📂ninja succeeded in 47s, results at: 📂C:\Repos\ninja\_results ✅ Build of 📂ninja succeeded in 47s, results in: 📂C:\Repos\ninja\_results
``` ```
@ -49,15 +48,14 @@ Script Content
.SYNOPSIS .SYNOPSIS
Builds a repo Builds a repo
.DESCRIPTION .DESCRIPTION
This PowerShell script builds a Git repository by supporting the following build This PowerShell script builds a Git repository by supporting the build systems: autogen, cmake, configure, Gradle, Imakefile, Makefile, and Meson.
systems: autogen, cargo, cmake, configure, Gradle, Imakefile, Makefile, and Meson.
.PARAMETER path .PARAMETER path
Specifies the file path to the Git repository (default: current working directory) Specifies the path to the Git repository (current working directory by default)
.EXAMPLE .EXAMPLE
PS> ./build-repo.ps1 C:\Repos\ninja PS> ./build-repo.ps1 C:\Repos\ninja
⏳ Building 📂ninja by using CMake... ⏳ Building 📂ninja by using CMake...
... ...
✅ Build of 📂ninja succeeded in 47s, results at: 📂C:\Repos\ninja\_results ✅ Build of 📂ninja succeeded in 47s, results in: 📂C:\Repos\ninja\_results
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -87,13 +85,6 @@ function BuildFolder([string]$path) {
"⏳ (4/4) Executing 'ctest -V'... (if tests are provided)" "⏳ (4/4) Executing 'ctest -V'... (if tests are provided)"
& ctest -V & ctest -V
if ($lastExitCode -ne 0) { throw "Executing 'ctest -V' failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "Executing 'ctest -V' failed with exit code $lastExitCode" }
} elseif (Test-Path "$path/.cargo/release.toml" -pathType leaf) {
"⏳ (1/4) Building 📂$dirName by using Cargo..."
Set-Location "$path/"
& cargo build --config .cargo/release.toml --release
if ($lastExitCode -ne 0) { throw "Executing 'cargo build' failed with exit code $lastExitCode" }
} elseif (Test-Path "$path/autogen.sh" -pathType leaf) { } elseif (Test-Path "$path/autogen.sh" -pathType leaf) {
"⏳ Building 📂$dirName by executing 'autogen.sh'..." "⏳ Building 📂$dirName by executing 'autogen.sh'..."
Set-Location "$path/" Set-Location "$path/"
@ -202,7 +193,7 @@ try {
if ($global:results -eq "") { if ($global:results -eq "") {
"✅ Build of 📂$repoDirName succeeded in $($elapsed)s." "✅ Build of 📂$repoDirName succeeded in $($elapsed)s."
} else { } else {
"✅ Build of 📂$repoDirName succeeded in $($elapsed)s, results at: 📂$($global:results)" "✅ Build of 📂$repoDirName succeeded in $($elapsed)s, results in: 📂$($global:results)"
} }
exit 0 # success exit 0 # success
} catch { } catch {
@ -212,4 +203,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -83,4 +83,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -16,8 +16,8 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-crashdumps.ps1 PS> ./cd-crashdumps
📂C:\Users\Markus\AppData\Local\CrashDumps with 3 files entered. 📂C:\Users\Markus\AppData\Local\CrashDumps entered (has 3 files and 0 folders)
``` ```
@ -38,8 +38,8 @@ Script Content
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the crash dumps directory (Windows only). Whenever a software crashes and crash dumps are enabled(!) a crash dump file is written. This file helps to identify the reason for the crash. This PowerShell script changes the working directory to the crash dumps directory (Windows only). Whenever a software crashes and crash dumps are enabled(!) a crash dump file is written. This file helps to identify the reason for the crash.
.EXAMPLE .EXAMPLE
PS> ./cd-crashdumps.ps1 PS> ./cd-crashdumps
📂C:\Users\Markus\AppData\Local\CrashDumps with 3 files entered. 📂C:\Users\Markus\AppData\Local\CrashDumps entered (has 3 files and 0 folders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -54,10 +54,10 @@ try {
$path += "\AppData\Local\CrashDumps" $path += "\AppData\Local\CrashDumps"
if (!(Test-Path "$path" -pathType container)) { throw "No crashdumps folder at $path" } if (!(Test-Path "$path" -pathType container)) { throw "No crashdumps folder at $path" }
Set-Location "$Path"
Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
"📂$path with $($files.Count) files entered." $folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) folders)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -65,4 +65,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -16,8 +16,8 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-desktop.ps1 PS> ./cd-desktop
📂/home/Markus/Desktop with 3 files and 0 folders entered. 📂/home/Markus/Desktop
``` ```
@ -38,8 +38,8 @@ Script Content
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the user's desktop folder. This PowerShell script changes the working directory to the user's desktop folder.
.EXAMPLE .EXAMPLE
PS> ./cd-desktop.ps1 PS> ./cd-desktop
📂/home/Markus/Desktop with 3 files and 0 folders entered. 📂/home/Markus/Desktop
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -49,19 +49,17 @@ Script Content
try { try {
if ($IsLinux -or $IsMacOS) { if ($IsLinux -or $IsMacOS) {
if (-not(Test-Path "~/Desktop" -pathType container)) { if (-not(Test-Path "~/Desktop" -pathType container)) {
throw "No 'Desktop' folder in your home directory yet" throw "No 📂Desktop folder in your home directory yet"
} }
$path = Resolve-Path "~/Desktop" $path = Resolve-Path "~/Desktop"
} else { } else {
$path = [Environment]::GetFolderPath('DesktopDirectory') $path = [Environment]::GetFolderPath('DesktopDirectory')
if (-not(Test-Path "$path" -pathType container)) { if (-not(Test-Path "$path" -pathType container)) {
throw "Desktop folder at $path does not exist yet" throw "No desktop folder at 📂$path yet"
} }
} }
Set-Location "$path" Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory "📂$path"
$folders = Get-ChildItem $path -attributes Directory
"📂$path with $($files.Count) files and $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -69,4 +67,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -1,7 +1,7 @@
The *cd-docs.ps1* Script The *cd-docs.ps1* Script
=========================== ===========================
This PowerShell script sets the current working directory to the documents folder. This PowerShell script changes the working directory to the documents folder.
Parameters Parameters
---------- ----------
@ -16,8 +16,8 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-docs.ps1 PS> ./cd-docs
📂C:\Users\Markus\Documents with 3 files and 0 folders entered. 📂C:\Users\Markus\Documents entered (has 3 files and 0 folders)
``` ```
@ -34,12 +34,12 @@ Script Content
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working dir to the documents folder Sets the working directory to the documents folder
.DESCRIPTION .DESCRIPTION
This PowerShell script sets the current working directory to the documents folder. This PowerShell script changes the working directory to the documents folder.
.EXAMPLE .EXAMPLE
PS> ./cd-docs.ps1 PS> ./cd-docs
📂C:\Users\Markus\Documents with 3 files and 0 folders entered. 📂C:\Users\Markus\Documents entered (has 3 files and 0 folders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -49,19 +49,19 @@ Script Content
try { try {
if ($IsLinux -or $IsMacOS) { if ($IsLinux -or $IsMacOS) {
if (-not(Test-Path "~/Documents" -pathType container)) { if (-not(Test-Path "~/Documents" -pathType container)) {
throw "No 'Documents' folder in your home directory yet" throw "No 📂Documents folder in your home directory yet"
} }
$path = Resolve-Path "~/Documents" $path = Resolve-Path "~/Documents"
} else { } else {
$path = [Environment]::GetFolderPath('MyDocuments') $path = [Environment]::GetFolderPath('MyDocuments')
if (-not(Test-Path "$path" -pathType container)) { if (-not(Test-Path "$path" -pathType container)) {
throw "No documents folder at: $path yet" throw "No documents folder at 📂$path yet"
} }
} }
Set-Location "$path" Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory $folders = Get-ChildItem $path -attributes Directory
"📂$path with $($files.Count) files and $($folders.Count) folders entered." "📂$path entered (has $($files.Count) files and $($folders.Count) folders)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -69,4 +69,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -16,8 +16,8 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-downloads.ps1 PS> ./cd-downloads
📂C:\Users\Markus\Downloads with 0 files and 0 folders entered. 📂C:\Users\Markus\Downloads entered (has 0 files and 0 folders)
``` ```
@ -38,8 +38,8 @@ Script Content
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the user's downloads folder. This PowerShell script changes the working directory to the user's downloads folder.
.EXAMPLE .EXAMPLE
PS> ./cd-downloads.ps1 PS> ./cd-downloads
📂C:\Users\Markus\Downloads with 0 files and 0 folders entered. 📂C:\Users\Markus\Downloads entered (has 0 files and 0 folders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -49,19 +49,19 @@ Script Content
try { try {
if ($IsLinux -or $IsMacOS) { if ($IsLinux -or $IsMacOS) {
if (-not(Test-Path "~/Downloads" -pathType container)) { if (-not(Test-Path "~/Downloads" -pathType container)) {
throw "No 'Downloads' folder in your home directory yet" throw "No 📂Downloads folder in your home directory yet"
} }
$path = Resolve-Path "~/Downloads" $path = Resolve-Path "~/Downloads"
} else { } else {
$path = (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path $path = (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path
if (-not(Test-Path "$path" -pathType container)) { if (-not(Test-Path "$path" -pathType container)) {
throw "No downloads folder at: $path" throw "No downloads folder at 📂$path"
} }
} }
Set-Location "$path" Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory $folders = Get-ChildItem $path -attributes Directory
"📂$path with $($files.Count) files and $($folders.Count) folders entered." "📂$path entered (has $($files.Count) files and $($folders.Count) folders)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -69,4 +69,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
------- -------
```powershell ```powershell
PS> ./cd-dropbox PS> ./cd-dropbox
📂C:\Users\Markus\Dropbox (has 2 files and 0 folders) 📂C:\Users\Markus\Dropbox (has 2 files and 4 subfolders)
``` ```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the user's Dropbox folder. This PowerShell script changes the working directory to the user's Dropbox folder.
.EXAMPLE .EXAMPLE
PS> ./cd-dropbox PS> ./cd-dropbox
📂C:\Users\Markus\Dropbox (has 2 files and 0 folders) 📂C:\Users\Markus\Dropbox (has 2 files and 4 subfolders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -48,13 +48,13 @@ Script Content
try { try {
if (-not(Test-Path "~/Dropbox" -pathType container)) { if (-not(Test-Path "~/Dropbox" -pathType container)) {
throw "No 'Dropbox' folder in your home directory - is Dropbox installed?" throw "No 📂Dropbox folder in your home directory - is Dropbox installed?"
} }
$path = Resolve-Path "~/Dropbox" $path = Resolve-Path "~/Dropbox"
Set-Location "$path" Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory $folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) folders)" "📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -62,4 +62,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
------- -------
```powershell ```powershell
PS> ./cd-etc PS> ./cd-etc
📂C:\Windows\System32\drivers\etc (has 5 files and 0 folders) 📂C:\Windows\System32\drivers\etc (has 2 files and 3 subfolders)
``` ```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the /etc directory. This PowerShell script changes the working directory to the /etc directory.
.EXAMPLE .EXAMPLE
PS> ./cd-etc PS> ./cd-etc
📂C:\Windows\System32\drivers\etc (has 5 files and 0 folders) 📂C:\Windows\System32\drivers\etc (has 2 files and 3 subfolders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -53,12 +53,12 @@ try {
$path = Resolve-Path "$env:WINDIR\System32\drivers\etc" $path = Resolve-Path "$env:WINDIR\System32\drivers\etc"
} }
if (-not(Test-Path "$path" -pathType container)) { if (-not(Test-Path "$path" -pathType container)) {
throw "No 'etc' folder found at: $path" throw "No /etc directory at 📂$path"
} }
Set-Location "$path" Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory $folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) folders)" "📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -66,4 +66,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -1,7 +1,7 @@
The *cd-fonts.ps1* Script The *cd-fonts.ps1* Script
=========================== ===========================
This PowerShell script sets the current working directory to the fonts folder. This PowerShell script changes the working directory to the fonts folder.
Parameters Parameters
---------- ----------
@ -16,8 +16,8 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-fonts.ps1 PS> ./cd-fonts
📂C:\Windows\Fonts with 12 font files entered. 📂C:\Windows\Fonts (has 2 file and 3 subfolders)
``` ```
@ -34,12 +34,12 @@ Script Content
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working dir to the fonts folder Sets the working directory to the fonts folder
.DESCRIPTION .DESCRIPTION
This PowerShell script sets the current working directory to the fonts folder. This PowerShell script changes the working directory to the fonts folder.
.EXAMPLE .EXAMPLE
PS> ./cd-fonts.ps1 PS> ./cd-fonts
📂C:\Windows\Fonts with 12 font files entered. 📂C:\Windows\Fonts (has 2 file and 3 subfolders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -49,11 +49,12 @@ Script Content
try { try {
$path = [Environment]::GetFolderPath('Fonts') $path = [Environment]::GetFolderPath('Fonts')
if (-not(Test-Path "$path" -pathType container)) { if (-not(Test-Path "$path" -pathType container)) {
throw "No fonts folder at: $path" throw "No fonts folder at 📂$path"
} }
Set-Location "$path" Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
"📂$path with $($files.Count) font files entered." $folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -61,4 +62,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
------- -------
```powershell ```powershell
PS> ./cd-home.ps1 PS> ./cd-home.ps1
📂C:\Users\Markus with 4 files and 7 folders entered. 📂C:\Users\Markus entered (has 4 files and 7 subfolders)
``` ```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the user's home directory. This PowerShell script changes the working directory to the user's home directory.
.EXAMPLE .EXAMPLE
PS> ./cd-home.ps1 PS> ./cd-home.ps1
📂C:\Users\Markus with 4 files and 7 folders entered. 📂C:\Users\Markus entered (has 4 files and 7 subfolders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -47,12 +47,12 @@ Script Content
#> #>
try { try {
if (-not(Test-Path "~" -pathType container)) { throw "No home directory at: $path" } if (-not(Test-Path "~" -pathType container)) { throw "No home directory at $path" }
$path = Resolve-Path "~" $path = Resolve-Path "~"
Set-Location "$path" Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory $folders = Get-ChildItem $path -attributes Directory
"📂$path with $($files.Count) files and $($folders.Count) folders entered." "📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -60,4 +60,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -65,4 +65,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -50,4 +50,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -16,8 +16,8 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-music.ps1 PS> ./cd-music
📂C:\Users\Markus\Music with 3 folders and 0 files entered. 📂C:\Users\Markus\Music entered (has 0 files and 3 subfolders)
``` ```
@ -38,8 +38,8 @@ Script Content
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the user's music folder. This PowerShell script changes the working directory to the user's music folder.
.EXAMPLE .EXAMPLE
PS> ./cd-music.ps1 PS> ./cd-music
📂C:\Users\Markus\Music with 3 folders and 0 files entered. 📂C:\Users\Markus\Music entered (has 0 files and 3 subfolders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -48,20 +48,17 @@ Script Content
try { try {
if ($IsLinux) { if ($IsLinux) {
if (-not(Test-Path "~/Music/" -pathType container)) {
throw "No 'Music' folder in home directory"
}
$path = Resolve-Path "~/Music" $path = Resolve-Path "~/Music"
} else { } else {
$path = [Environment]::GetFolderPath('MyMusic') $path = [Environment]::GetFolderPath('MyMusic')
if (-not(Test-Path "$path" -pathType container)) { }
throw "No music folder at: $path" if (-not(Test-Path "$path" -pathType container)) {
} throw "No music folder at 📂$path"
} }
Set-Location "$path" Set-Location "$path"
$folders = Get-ChildItem $path -attributes Directory
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
"📂$path with $($folders.Count) folders and $($files.Count) files entered." $folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -69,4 +66,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
------- -------
```powershell ```powershell
PS> ./cd-nextcloud PS> ./cd-nextcloud
📂C:\Users\Markus\NextCloud entered (has 2 files and 0 folders) 📂C:\Users\Markus\NextCloud entered (has 2 files and 3 subfolders)
``` ```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the user's NextCloud folder. This PowerShell script changes the working directory to the user's NextCloud folder.
.EXAMPLE .EXAMPLE
PS> ./cd-nextcloud PS> ./cd-nextcloud
📂C:\Users\Markus\NextCloud entered (has 2 files and 0 folders) 📂C:\Users\Markus\NextCloud entered (has 2 files and 3 subfolders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -47,14 +47,14 @@ Script Content
#> #>
try { try {
if (-not(Test-Path "~/NextCloud" -pathType container)) {
throw "No 'NextCloud' folder in your home directory - is NextCloud installed?"
}
$path = Resolve-Path "~/NextCloud" $path = Resolve-Path "~/NextCloud"
if (-not(Test-Path "$path" -pathType container)) {
throw "No NextCloud folder at $path - is NextCloud installed?"
}
Set-Location "$path" Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory $folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) folders)" "📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -62,4 +62,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -1,7 +1,7 @@
The *cd-onedrive.ps1* Script The *cd-onedrive.ps1* Script
=========================== ===========================
This PowerShell script sets the current working directory to the user's OneDrive folder. This PowerShell script changes the working directory to the user's OneDrive folder.
Parameters Parameters
---------- ----------
@ -16,8 +16,8 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-onedrive.ps1 PS> ./cd-onedrive
📂C:\Users\Markus\OneDrive with 2 files and 0 folders entered. 📂C:\Users\Markus\OneDrive entered (has 2 files and 3 subfolders)
``` ```
@ -34,12 +34,12 @@ Script Content
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working dir to the OneDrive folder Sets the working directory to the user's OneDrive folder
.DESCRIPTION .DESCRIPTION
This PowerShell script sets the current working directory to the user's OneDrive folder. This PowerShell script changes the working directory to the user's OneDrive folder.
.EXAMPLE .EXAMPLE
PS> ./cd-onedrive.ps1 PS> ./cd-onedrive
📂C:\Users\Markus\OneDrive with 2 files and 0 folders entered. 📂C:\Users\Markus\OneDrive entered (has 2 files and 3 subfolders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -47,14 +47,14 @@ Script Content
#> #>
try { try {
if (-not(Test-Path "~/OneDrive" -pathType container)) {
throw "No 'OneDrive' folder in your home directory - is OneDrive installed?"
}
$path = Resolve-Path "~/OneDrive" $path = Resolve-Path "~/OneDrive"
if (-not(Test-Path "$path" -pathType container)) {
throw "No OneDrive folder at $path - is OneDrive installed?"
}
Set-Location "$path" Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory $folders = Get-ChildItem $path -attributes Directory
"📂$path with $($files.Count) files and $($folders.Count) folders entered." "📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -62,4 +62,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -1,7 +1,7 @@
The *cd-pics.ps1* Script The *cd-pics.ps1* Script
=========================== ===========================
This PowerShell script sets the current working directory to the user's pictures folder. This PowerShell script changes the working directory to the user's pictures folder.
Parameters Parameters
---------- ----------
@ -16,8 +16,8 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-pics.ps1 PS> ./cd-pics
📂C:\Users\Markus\Pictures with 7 files and 0 folders entered. 📂C:\Users\Markus\Pictures entered (has 7 files and 0 subfolders)
``` ```
@ -34,12 +34,12 @@ Script Content
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working dir to the user's pictures folder Sets the working directory to the user's pictures folder
.DESCRIPTION .DESCRIPTION
This PowerShell script sets the current working directory to the user's pictures folder. This PowerShell script changes the working directory to the user's pictures folder.
.EXAMPLE .EXAMPLE
PS> ./cd-pics.ps1 PS> ./cd-pics
📂C:\Users\Markus\Pictures with 7 files and 0 folders entered. 📂C:\Users\Markus\Pictures entered (has 7 files and 0 subfolders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -48,20 +48,17 @@ Script Content
try { try {
if ($IsLinux) { if ($IsLinux) {
if (-not(Test-Path "~/Pictures" -pathType container)) {
throw "No 'Pictures' folder in your home directory yet"
}
$path = Resolve-Path "~/Pictures" $path = Resolve-Path "~/Pictures"
} else { } else {
$path = [Environment]::GetFolderPath('MyPictures') $path = [Environment]::GetFolderPath('MyPictures')
if (-not(Test-Path "$path" -pathType container)) { }
throw "No pictures folder at: $path" if (-not(Test-Path "$path" -pathType container)) {
} throw "No pictures folder at $path"
} }
Set-Location "$path" Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory $folders = Get-ChildItem $path -attributes Directory
"📂$path with $($files.Count) files and $($folders.Count) folders entered." "📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -69,4 +66,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -1,7 +1,7 @@
The *cd-public.ps1* Script The *cd-public.ps1* Script
=========================== ===========================
This PowerShell script sets the current working directory to the Public folder. This PowerShell script changes the working directory to the Public folder.
Parameters Parameters
---------- ----------
@ -16,8 +16,8 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-public.ps1 PS> ./cd-public
📂C:\Users\Public with 2 files and 3 folders entered. 📂C:\Users\Public entered (has 2 files and 3 subfolders)
``` ```
@ -34,12 +34,12 @@ Script Content
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working dir to the Public folder Sets the working directory to the Public folder
.DESCRIPTION .DESCRIPTION
This PowerShell script sets the current working directory to the Public folder. This PowerShell script changes the working directory to the Public folder.
.EXAMPLE .EXAMPLE
PS> ./cd-public.ps1 PS> ./cd-public
📂C:\Users\Public with 2 files and 3 folders entered. 📂C:\Users\Public entered (has 2 files and 3 subfolders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -48,20 +48,17 @@ Script Content
try { try {
if ($IsLinux) { if ($IsLinux) {
if (-not(Test-Path "~/Public" -pathType container)) {
throw "No 'Public' folder in your home directory yet"
}
$path = Resolve-Path "~/Public" $path = Resolve-Path "~/Public"
} else { } else {
if (-not(Test-Path "~/../Public" -pathType container)) {
throw "No 'Public' folder yet"
}
$path = Resolve-Path "~/../Public" $path = Resolve-Path "~/../Public"
} }
if (-not(Test-Path "$path" -pathType container)) {
throw "No public folder at $path"
}
Set-Location "$path" Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory $folders = Get-ChildItem $path -attributes Directory
"📂$path with $($files.Count) files and $($folders.Count) folders entered." "📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -69,4 +66,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -62,4 +62,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -57,4 +57,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -90,4 +90,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
------- -------
```powershell ```powershell
PS> ./cd-repos.ps1 PS> ./cd-repos.ps1
📂C:\Repos with 33 folders entered. 📂C:\Repos (has 33 subfolders)
``` ```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the folder for Git repositories. This PowerShell script changes the working directory to the folder for Git repositories.
.EXAMPLE .EXAMPLE
PS> ./cd-repos.ps1 PS> ./cd-repos.ps1
📂C:\Repos with 33 folders entered. 📂C:\Repos (has 33 subfolders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -57,11 +57,13 @@ try {
} elseif (Test-Path "/repositories" -pathType container) { $path = "/repositories" } elseif (Test-Path "/repositories" -pathType container) { $path = "/repositories"
} elseif (Test-Path "~/source/repos" -pathType container) { $path = "~/source/repos" # Visual Studio default } 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 } elseif (Test-Path "D:/Repos" -pathType container) { $path = "D:/Repos" # second HDD
} else { throw "Found no folder for Git repositories (in home or root directory) - Please create one." } } else {
throw "No folder found for Git repositories (in home or root directory) - Please create one."
}
$path = Resolve-Path $path $path = Resolve-Path $path
Set-Location "$path" Set-Location "$path"
$folders = Get-ChildItem $path -attributes Directory $subfolders = Get-ChildItem $path -attributes Directory
"📂$path with $($folders.Count) folders entered." "📂$path entered (has $($subfolders.Count) subfolders)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -69,4 +71,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -16,8 +16,8 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-root.ps1 PS> ./cd-root
📂C:\ with 7 folders and 0 files entered. 📂C:\ entered (has 0 files and 7 folders)
``` ```
@ -34,12 +34,12 @@ Script Content
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working dir to the root dir Sets the working directory to the root directory
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the current working directory to the root directory (C:\ on Windows). This PowerShell script changes the current working directory to the root directory (C:\ on Windows).
.EXAMPLE .EXAMPLE
PS> ./cd-root.ps1 PS> ./cd-root
📂C:\ with 7 folders and 0 files entered. 📂C:\ entered (has 0 files and 7 folders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -47,11 +47,11 @@ Script Content
#> #>
try { try {
if ($IsLinux -or $IsMacOS) { $path = "/" } else { $path = "C:\" } if ($IsLinux) { $path = "/" } else { $path = "C:\" }
Set-Location "$path" Set-Location "$path"
$folders = Get-ChildItem $path -attributes Directory
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
"📂$path with $($folders.Count) folders and $($files.Count) files entered." $folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) folders)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -59,4 +59,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -19,12 +19,12 @@ Script Content
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working dir to the user's screenshots folder Sets the working directory to the user's screenshots folder
.DESCRIPTION .DESCRIPTION
This PowerShell script sets the current working directory to the user's screenshots folder. This PowerShell script changes the working directory to the user's screenshots folder.
.EXAMPLE .EXAMPLE
PS> ./cd-screenshots.ps1 PS> ./cd-screenshots
📂C:\Users\Markus\Pictures\Screenshots with 7 files and 0 folders entered. 📂C:\Users\Markus\Pictures\Screenshots (has 7 files and 0 folders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -33,12 +33,12 @@ Script Content
function GetScreenshotsFolder { function GetScreenshotsFolder {
if ($IsLinux) { if ($IsLinux) {
if (-not(Test-Path "~/Pictures" -pathType container)) { throw "No 'Pictures' folder in your home directory yet" }
$path = "~/Pictures" $path = "~/Pictures"
if (-not(Test-Path "$path" -pathType container)) { throw "Pictures folder at $path doesn't exist (yet)" }
if (Test-Path "$path/Screenshots" -pathType container) { $path = "$path/Screenshots" } if (Test-Path "$path/Screenshots" -pathType container) { $path = "$path/Screenshots" }
} else { } else {
$path = [Environment]::GetFolderPath('MyPictures') $path = [Environment]::GetFolderPath('MyPictures')
if (-not(Test-Path "$path" -pathType container)) { throw "No pictures folder at: $path" } if (-not(Test-Path "$path" -pathType container)) { throw "Pictures folder at $path doesn't exist (yet)" }
if (Test-Path "$path\Screenshots" -pathType container) { $path = "$path\Screenshots" } if (Test-Path "$path\Screenshots" -pathType container) { $path = "$path\Screenshots" }
} }
return $path return $path
@ -49,7 +49,7 @@ try {
Set-Location "$path" Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory $folders = Get-ChildItem $path -attributes Directory
"📂$path with $($files.Count) files and $($folders.Count) folders entered." "📂$path entered (has $($files.Count) files and $($folders.Count) folders)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -57,4 +57,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
------- -------
```powershell ```powershell
PS> ./cd-scripts.ps1 PS> ./cd-scripts.ps1
📂C:\Repos\PowerShell\scripts with 655 scripts entered. 📂C:\Repos\PowerShell\scripts entered (has 645 scripts)
``` ```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the PowerShell scripts folder. This PowerShell script changes the working directory to the PowerShell scripts folder.
.EXAMPLE .EXAMPLE
PS> ./cd-scripts.ps1 PS> ./cd-scripts.ps1
📂C:\Repos\PowerShell\scripts with 655 scripts entered. 📂C:\Repos\PowerShell\scripts entered (has 645 scripts)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -48,10 +48,12 @@ Script Content
try { try {
$path = Resolve-Path "$PSScriptRoot" $path = Resolve-Path "$PSScriptRoot"
if (-not(Test-Path "$path" -pathType container)) { throw "No scripts folder at: $path" } if (-not(Test-Path "$path" -pathType container)) {
throw "No PowerShell scripts folder at 📂$path"
}
Set-Location "$path" Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
"📂$path with $($files.Count) scripts entered." "📂$path entered (has $($files.Count) scripts)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -59,4 +61,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -1,7 +1,7 @@
The *cd-ssh.ps1* Script The *cd-ssh.ps1* Script
=========================== ===========================
This PowerShell script sets the current working directory to the user's secure shell (SSH) folder. This PowerShell script changes the working directory to the user's secure shell (SSH) folder.
Parameters Parameters
---------- ----------
@ -17,7 +17,7 @@ Example
------- -------
```powershell ```powershell
PS> ./cd-ssh.ps1 PS> ./cd-ssh.ps1
📂C:\Users\Markus\.ssh with 4 files entered. 📂C:\Users\Markus\.ssh entered (has 4 files)
``` ```
@ -34,12 +34,12 @@ Script Content
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working dir to the SSH folder Sets the working directory to the SSH folder
.DESCRIPTION .DESCRIPTION
This PowerShell script sets the current working directory to the user's secure shell (SSH) folder. This PowerShell script changes the working directory to the user's secure shell (SSH) folder.
.EXAMPLE .EXAMPLE
PS> ./cd-ssh.ps1 PS> ./cd-ssh.ps1
📂C:\Users\Markus\.ssh with 4 files entered. 📂C:\Users\Markus\.ssh entered (has 4 files)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -49,12 +49,12 @@ Script Content
try { try {
$path = "~/.ssh" $path = "~/.ssh"
if (-not(Test-Path "$path" -pathType container)) { if (-not(Test-Path "$path" -pathType container)) {
throw "No '.ssh' folder in your home directory yet - Is SSH installed?" throw "No secure shell (SSH) folder at $path"
} }
$path = Resolve-Path "$path" $path = Resolve-Path "$path"
Set-Location "$path" Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
"📂$path with $($files.Count) files entered." "📂$path entered (has $($files.Count) files)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -62,4 +62,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -1,65 +0,0 @@
The *cd-sync.ps1* Script
===========================
This PowerShell script changes the working directory to the user's Syncthing folder.
Parameters
----------
```powershell
/Repos/PowerShell/scripts/cd-sync.ps1 [<CommonParameters>]
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
```
Example
-------
```powershell
PS> ./cd-sync.ps1
📂C:\Users\Markus\Sync entered (has 2 files and 0 folders)
```
Notes
-----
Author: Markus Fleschutz | License: CC0
Related Links
-------------
https://github.com/fleschutz/PowerShell
Script Content
--------------
```powershell
<#
.SYNOPSIS
Sets the working directory to the user's Sync folder
.DESCRIPTION
This PowerShell script changes the working directory to the user's Syncthing folder.
.EXAMPLE
PS> ./cd-sync.ps1
📂C:\Users\Markus\Sync entered (has 2 files and 0 folders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
if (-not(Test-Path "~/Sync" -pathType container)) {
throw "No 'Sync' folder in your home directory - is Syncthing installed?"
}
$path = Resolve-Path "~/Sync"
Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) folders)"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*

View File

@ -54,4 +54,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -1,7 +1,7 @@
The *cd-templates.ps1* Script The *cd-templates.ps1* Script
=========================== ===========================
This PowerShell script sets the current working directory to the templates folder. This PowerShell script changes the working directory to the templates folder.
Parameters Parameters
---------- ----------
@ -16,8 +16,8 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-templates.ps1 PS> ./cd-templates
📂/home/Markus/Templates with 3 files and 0 folders entered. 📂/home/Markus/Templates entered (has 3 files and 0 subfolders)
``` ```
@ -34,12 +34,12 @@ Script Content
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working dir to the templates folder Sets the working directory to the templates folder
.DESCRIPTION .DESCRIPTION
This PowerShell script sets the current working directory to the templates folder. This PowerShell script changes the working directory to the templates folder.
.EXAMPLE .EXAMPLE
PS> ./cd-templates.ps1 PS> ./cd-templates
📂/home/Markus/Templates with 3 files and 0 folders entered. 📂/home/Markus/Templates entered (has 3 files and 0 subfolders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -48,20 +48,17 @@ Script Content
try { try {
if ($IsLinux) { if ($IsLinux) {
if (-not(Test-Path "~/Templates" -pathType container)) {
throw "No 'Templates' folder in your home directory yet"
}
$path = Resolve-Path "~/Templates" $path = Resolve-Path "~/Templates"
} else { } else {
$path = [Environment]::GetFolderPath('Templates') $path = [Environment]::GetFolderPath('Templates')
if (-not(Test-Path "$path" -pathType container)) { }
throw "No templates folder at: $path" if (-not(Test-Path "$path" -pathType container)) {
} throw "No templates folder at $path"
} }
Set-Location "$path" Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory $folders = Get-ChildItem $path -attributes Directory
"📂$path with $($files.Count) files and $($folders.Count) folders entered." "📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -69,4 +66,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -57,4 +57,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -1,7 +1,7 @@
The *cd-users.ps1* Script The *cd-users.ps1* Script
=========================== ===========================
This PowerShell script sets the current working directory to the users directory. This PowerShell script changes the working directory to the users directory.
Parameters Parameters
---------- ----------
@ -16,8 +16,8 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-users.ps1 PS> ./cd-users
📂C:\Users with 4 folders entered. 📂C:\Users entered (has 0 files and 4 subfolders)
``` ```
@ -34,12 +34,12 @@ Script Content
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working dir to the users directory Sets the working directory to the users directory
.DESCRIPTION .DESCRIPTION
This PowerShell script sets the current working directory to the users directory. This PowerShell script changes the working directory to the users directory.
.EXAMPLE .EXAMPLE
PS> ./cd-users.ps1 PS> ./cd-users
📂C:\Users with 4 folders entered. 📂C:\Users entered (has 0 files and 4 subfolders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -49,11 +49,12 @@ Script Content
try { try {
$path = Resolve-Path "~/.." $path = Resolve-Path "~/.."
if (-not(Test-Path "$path" -pathType container)) { if (-not(Test-Path "$path" -pathType container)) {
throw "No users directory at: $path" throw "No users directory at $path"
} }
Set-Location "$path" Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory $folders = Get-ChildItem $path -attributes Directory
"📂$path with $($folders.Count) folders entered." "📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -61,4 +62,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -66,4 +66,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
------- -------
```powershell ```powershell
PS> ./cd-windows PS> ./cd-windows
📂C:\Windows entered (has 7 files and 42 folders) 📂C:\Windows entered (has 7 files and 42 subfolders)
``` ```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the Windows directory. This PowerShell script changes the working directory to the Windows directory.
.EXAMPLE .EXAMPLE
PS> ./cd-windows PS> ./cd-windows
📂C:\Windows entered (has 7 files and 42 folders) 📂C:\Windows entered (has 7 files and 42 subfolders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -54,7 +54,7 @@ try {
Set-Location "$path" Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory $folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) folders)" "📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -62,4 +62,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -80,4 +80,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -67,4 +67,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -72,4 +72,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -75,4 +75,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -104,4 +104,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -83,4 +83,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -57,4 +57,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -72,4 +72,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -37,7 +37,7 @@ Example
------- -------
```powershell ```powershell
PS> ./check-drive-space.ps1 C PS> ./check-drive-space.ps1 C
✅ Drive C: uses 56% of 1TB: 442GB free ✅ Drive C: uses 56% of 1TB - 442GB free
``` ```
@ -63,7 +63,7 @@ Script Content
Specifies the minimum level in bytes (10GB by default) Specifies the minimum level in bytes (10GB by default)
.EXAMPLE .EXAMPLE
PS> ./check-drive-space.ps1 C PS> ./check-drive-space.ps1 C
✅ Drive C: uses 56% of 1TB: 442GB free ✅ Drive C: uses 56% of 1TB - 442GB free
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -103,7 +103,7 @@ try {
Write-Host "⚠️ Drive $driveName with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free" Write-Host "⚠️ Drive $driveName with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free"
} else { } else {
[int64]$percent = ($used * 100) / $total [int64]$percent = ($used * 100) / $total
Write-Host "✅ Drive $driveName uses $percent% of $(Bytes2String $total): $(Bytes2String $free) free" Write-Host "✅ Drive $driveName uses $percent% of $(Bytes2String $total) - $(Bytes2String $free) free"
} }
exit 0 # success exit 0 # success
} catch { } catch {
@ -112,4 +112,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -103,4 +103,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -63,4 +63,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -61,4 +61,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -76,4 +76,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -171,4 +171,4 @@ function Check-Header { param( $path )
Check-Header $Path Check-Header $Path
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -65,4 +65,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -67,4 +67,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -64,4 +64,4 @@ Write-Host "`n === H A R D W A R E ===" -foregroundColor green
exit 0 # success exit 0 # success
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -58,4 +58,4 @@ Script Content
exit 0 # success exit 0 # success
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -61,4 +61,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -85,4 +85,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -99,4 +99,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -55,4 +55,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -88,4 +88,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -57,4 +57,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -76,4 +76,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -59,4 +59,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -67,4 +67,4 @@ Write-Host "`n === N E T W O R K ===" -foregroundColor green
exit 0 # success exit 0 # success
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -59,4 +59,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -73,4 +73,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -65,4 +65,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -95,4 +95,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -90,4 +90,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -65,4 +65,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -91,4 +91,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -59,4 +59,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -77,4 +77,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -98,4 +98,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -130,4 +130,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -92,4 +92,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -56,4 +56,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -120,4 +120,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -64,4 +64,4 @@ Write-Host "`n === S O F T W A R E ===" -foregroundColor green
exit 0 # success exit 0 # success
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -85,4 +85,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -99,7 +99,7 @@ try {
Write-Output "✅ Swap space has $(MB2String $total) reserved." Write-Output "✅ Swap space has $(MB2String $total) reserved."
} else { } else {
[int64]$percent = ($used * 100) / $total [int64]$percent = ($used * 100) / $total
Write-Output "✅ Swap space uses $percent% of $(MB2String $total): $(MB2String $free) free" Write-Output "✅ Swap space at $(MB2String $used) ($percent%) of $(MB2String $total)."
} }
exit 0 # success exit 0 # success
} catch { } catch {
@ -108,4 +108,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -99,4 +99,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -66,4 +66,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -114,4 +114,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -65,4 +65,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -82,4 +82,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -54,4 +54,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -73,4 +73,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -86,4 +86,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -9,7 +9,7 @@ Parameters
/Repos/PowerShell/scripts/check-xml-files.ps1 [[-path] <String>] [<CommonParameters>] /Repos/PowerShell/scripts/check-xml-files.ps1 [[-path] <String>] [<CommonParameters>]
-path <String> -path <String>
Specifies the file path to the directory tree (current working dir by default) Specifies the path to the directory tree (current working dir by default)
Required? false Required? false
Position? 1 Position? 1
@ -49,7 +49,7 @@ Script Content
.DESCRIPTION .DESCRIPTION
This PowerShell script verifies any XML file (with suffix .xml) in the given directory tree for validity. This PowerShell script verifies any XML file (with suffix .xml) in the given directory tree for validity.
.PARAMETER path .PARAMETER path
Specifies the file path to the directory tree (current working dir by default) Specifies the path to the directory tree (current working dir by default)
.EXAMPLE .EXAMPLE
PS> ./check-xml-files.ps1 C:\Windows PS> ./check-xml-files.ps1 C:\Windows
... ...
@ -65,24 +65,23 @@ param([string]$path = "$PWD")
try { try {
$stopWatch = [system.diagnostics.stopwatch]::startNew() $stopWatch = [system.diagnostics.stopwatch]::startNew()
$path = Resolve-Path "$path" $path = Resolve-Path "$path"
Write-Progress "Scanning any XML file within $path..."
[int]$valid = [int]$invalid = 0 [int]$valid = [int]$invalid = 0
Get-ChildItem -path "$path" -attributes !Directory -recurse -force | Where-Object { $_.Name -like "*.xml" } | Foreach-Object { Get-ChildItem -path "$path" -attributes !Directory -recurse -force | Where-Object { $_.Name -like "*.xml" } | Foreach-Object {
& $PSScriptRoot/check-xml-file.ps1 "$($_.FullName)" & $PSScriptRoot/check-xml-file.ps1 "$($_.FullName)"
if ($lastExitCode -eq 0) { $valid++ } else { $invalid++ } if ($lastExitCode -eq 0) { $valid++ } else { $invalid++ }
} }
Write-Progress -completed "Done."
[int]$total = $valid + $invalid
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds [int]$elapsed = $stopWatch.Elapsed.TotalSeconds
if ($invalid -ne 0) { "✅ Checked $total XML files ($invalid invalid, $valid valid) within 📂$path in $elapsed sec"
"⚠️ $invalid XML files are INVALID, $valid are valid (took $($elapsed)s)."
} else {
"✅ All $valid XML files are valid (took $($elapsed)s)."
}
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -99,4 +99,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -101,4 +101,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

Some files were not shown because too many files have changed in this diff Show More