Updated the manuals

This commit is contained in:
Markus Fleschutz
2025-08-06 15:18:49 +02:00
parent d3bc243e6b
commit 7e7b318aaf
661 changed files with 2839 additions and 1288 deletions

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

View File

@ -28,9 +28,9 @@ Example
------- -------
```powershell ```powershell
PS> ./build-repo.ps1 C:\Repos\ninja PS> ./build-repo.ps1 C:\Repos\ninja
Building 📂ninja by using CMake... Building 'ninja' by executing cmake...
... ...
Build of 📂ninja succeeded in 47s, results at: 📂C:\Repos\ninja\_results Build of 'ninja' succeeded in 47s, results at: 📂C:\Repos\ninja\_results
``` ```
@ -55,9 +55,9 @@ Script Content
Specifies the file path to the Git repository (default: current working directory) Specifies the file path to the Git repository (default: current working directory)
.EXAMPLE .EXAMPLE
PS> ./build-repo.ps1 C:\Repos\ninja PS> ./build-repo.ps1 C:\Repos\ninja
⏳ Building 📂ninja by using CMake... ⏳ Building 'ninja' by executing cmake...
... ...
✅ Build of 📂ninja succeeded in 47s, results at: 📂C:\Repos\ninja\_results ✅ Build of 'ninja' succeeded in 47s, results at: 📂C:\Repos\ninja\_results
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -69,117 +69,120 @@ param([string]$path = "$PWD")
function BuildFolder([string]$path) { function BuildFolder([string]$path) {
$dirName = (Get-Item "$path").Name $dirName = (Get-Item "$path").Name
if (Test-Path "$path/CMakeLists.txt" -pathType leaf) { if (Test-Path "$path/CMakeLists.txt" -pathType leaf) {
"⏳ (1/4) Building 📂$dirName by using CMake..." "⏳ (1/3) Building '$dirName' by executing cmake..."
$global:results = "$path/_results/" $global:results = "$path/_results/"
if (-not(Test-Path $global:results -pathType container)) { if (-not(Test-Path $global:results -pathType container)) {
& mkdir $global:results & mkdir $global:results
} }
Set-Location $global:results Set-Location $global:results
"⏳ (2/4) Executing 'cmake' to generate the Makefile..."
& cmake .. & cmake ..
if ($lastExitCode -ne 0) { throw "Executing 'cmake ..' failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "Executing 'cmake ..' failed with exit code $lastExitCode" }
"⏳ (3/4) Executing 'make -j4' to compile and link..." "⏳ (2/3) Executing 'make -j4' to compile and link..."
& make -j4 & make -j4
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" }
"⏳ (4/4) Executing 'ctest -V'... (if tests are provided)" "⏳ (3/3) Checking '$dirName' by 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) { } elseif (Test-Path "$path/.cargo/release.toml" -pathType leaf) {
"⏳ (1/4) Building 📂$dirName by using Cargo..."
Set-Location "$path/"
"⏳ Building '$dirName' by executing 'cargo build'..."
Set-Location "$path/"
& cargo build --config .cargo/release.toml --release & cargo build --config .cargo/release.toml --release
if ($lastExitCode -ne 0) { throw "Executing 'cargo build' failed with exit code $lastExitCode" } 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'..."
"⏳ (1/3) Building '$dirName' by executing 'autogen.sh'..."
Set-Location "$path/" Set-Location "$path/"
& ./autogen.sh --force & ./autogen.sh --force
if ($lastExitCode -ne 0) { throw "Executing './autogen.sh --force' failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "Executing './autogen.sh --force' failed with exit code $lastExitCode" }
"⏳ Executing './configure'..." "⏳ (2/3) Executing './configure'..."
& ./configure & ./configure
if ($lastExitCode -ne 0) { throw "Executing './configure' failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "Executing './configure' failed with exit code $lastExitCode" }
"⏳ (3/3) Executing 'make -j4' to compile and link..."
& make -j4 & make -j4
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" }
} elseif (Test-Path "$path/configure" -pathType leaf) { } elseif (Test-Path "$path/configure" -pathType leaf) {
"⏳ Building 📂$dirName by executing './configure' and 'make'..."
Set-Location "$path/"
"⏳ (1/3) Building '$dirName' by executing './configure'..."
Set-Location "$path/"
& ./configure & ./configure
#if ($lastExitCode -ne 0) { throw "Executing './configure' exited with error code $lastExitCode" } #if ($lastExitCode -ne 0) { throw "Executing './configure' exited with error code $lastExitCode" }
"⏳ (2/3) Compiling and linking '$dirName' by executing 'make -j4'..."
& make -j4 & make -j4
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" }
"⏳ (3/3) Checking '$dirName' by executing 'make test'..."
& make test & make test
if ($lastExitCode -ne 0) { throw "Executing 'make test' failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "Executing 'make test' failed with exit code $lastExitCode" }
} elseif (Test-Path "$path/build.gradle" -pathType leaf) { } elseif (Test-Path "$path/build.gradle" -pathType leaf) {
"⏳ Building 📂$dirName by using Gradle..."
Set-Location "$path"
"⏳ (1/2) Building '$dirName' by executing 'gradle build'..."
Set-Location "$path"
& gradle build & gradle build
if ($lastExitCode -ne 0) { throw "Executing 'gradle build' failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "Executing 'gradle build' failed with exit code $lastExitCode" }
"⏳ (2/2) Checking '$dirName' by executing 'gradle test'..."
& gradle test & gradle test
if ($lastExitCode -ne 0) { throw "Executing 'gradle test' failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "Executing 'gradle test' failed with exit code $lastExitCode" }
} elseif (Test-Path "$path/meson.build" -pathType leaf) { } elseif (Test-Path "$path/meson.build" -pathType leaf) {
"⏳ Building 📂$dirName by using Meson..." "⏳ Building '$dirName' by using Meson..."
Set-Location "$path" Set-Location "$path"
& meson . build --prefix=/usr/local & meson . build --prefix=/usr/local
if ($lastExitCode -ne 0) { throw "Executing 'meson . build' failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "Executing 'meson . build' failed with exit code $lastExitCode" }
} elseif (Test-Path "$path/Imakefile" -pathType leaf) { } elseif (Test-Path "$path/Imakefile" -pathType leaf) {
"⏳ Building 📂$dirName by using Imakefile..." "⏳ Building '$dirName' by using Imakefile..."
Set-Location "$path/" Set-Location "$path/"
& xmkmf & xmkmf
if ($lastExitCode -ne 0) { throw "Executing 'xmkmf' failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "Executing 'xmkmf' failed with exit code $lastExitCode" }
"⏳ Executing 'make -j4' to compile and link..."
& make -j4 & make -j4
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" }
} elseif (Test-Path "$path/Makefile" -pathType leaf) { } elseif (Test-Path "$path/Makefile" -pathType leaf) {
"⏳ Building 📂$dirName by using Makefile..."
Set-Location "$path"
"⏳ Building '$dirName' by using Makefile..."
Set-Location "$path"
& make -j4 & make -j4
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" }
} elseif (Test-Path "$path/makefile" -pathType leaf) { } elseif (Test-Path "$path/makefile" -pathType leaf) {
"⏳ Building 📂$dirName by using makefile..." "⏳ Building '$dirName' by using makefile..."
Set-Location "$path" Set-Location "$path"
& make -j4 & make -j4
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" }
} elseif (Test-Path "$path/compile.sh" -pathType leaf) { } elseif (Test-Path "$path/compile.sh" -pathType leaf) {
"⏳ Building 📂$dirName by executing 'compile.sh'..."
Set-Location "$path/"
"⏳ Building '$dirName' by executing 'compile.sh'..."
Set-Location "$path/"
& ./compile.sh & ./compile.sh
if ($lastExitCode -ne 0) { throw "Executing './compile.sh' failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "Executing './compile.sh' failed with exit code $lastExitCode" }
"⏳ Executing 'make -j4' to compile and link..."
& make -j4 & make -j4
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" }
} elseif (Test-Path "$path/attower/src/build/DevBuild/build.bat" -pathType leaf) { } elseif (Test-Path "$path/attower/src/build/DevBuild/build.bat" -pathType leaf) {
Write-Host "⏳ Building 📂$dirName by executing 'build.bat'..." Write-Host "⏳ Building '$dirName' by executing 'build.bat'..."
Set-Location "$path/attower/src/build/DevBuild/" Set-Location "$path/attower/src/build/DevBuild/"
& ./build.bat build-core-release & ./build.bat build-core-release
if ($lastExitCode -ne 0) { throw "Executing 'build.bat' failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "Executing 'build.bat' failed with exit code $lastExitCode" }
$global:results = "$path\attower\Executables" $global:results = "$path\attower\Executables"
} elseif (Test-Path "$path/$dirName" -pathType container) { } elseif (Test-Path "$path/$dirName" -pathType container) {
"⏳ No make rule found, trying subfolder 📂$($dirName)..." "⏳ No make rule found, trying subfolder '$($dirName)'..."
BuildFolder "$path/$dirName" BuildFolder "$path/$dirName"
} else { } else {
Write-Warning "Sorry, no make rule applies to: 📂$dirName" Write-Warning "Sorry, no make rule applies to: 📂$dirName"
@ -197,19 +200,19 @@ try {
BuildFolder "$path" BuildFolder "$path"
Set-Location "$previousPath" Set-Location "$previousPath"
$repoDirName = (Get-Item "$path").Name $dirName = (Get-Item "$path").Name
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds [int]$elapsed = $stopWatch.Elapsed.TotalSeconds
if ($global:results -eq "") { if ($global:results -eq "") {
"✅ Build of 📂$repoDirName succeeded in $($elapsed)s." "✅ Build of '$dirName' succeeded in $($elapsed)s."
} else { } else {
"✅ Build of 📂$repoDirName succeeded in $($elapsed)s, results at: 📂$($global:results)" "✅ Build of '$dirName' succeeded in $($elapsed)s, results at: 📂$($global:results)"
} }
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ ERROR: $($Error[0]) in script line $($_.InvocationInfo.ScriptLineNumber)."
Set-Location "$previousPath" Set-Location "$previousPath"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -78,9 +78,9 @@ try {
"✅ Built $FolderCount Git repositories at 📂$ParentDirName in $Elapsed sec" "✅ Built $FolderCount Git repositories at 📂$ParentDirName in $Elapsed sec"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ ERROR: $($Error[0]) in script line $($_.InvocationInfo.ScriptLineNumber)."
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

61
docs/calculate-BMI.md Normal file
View File

@ -0,0 +1,61 @@
The *calculate-BMI.ps1* Script
===========================
This PowerShell script calculates the BMI.
Parameters
----------
```powershell
/Repos/PowerShell/scripts/calculate-BMI.ps1 [<CommonParameters>]
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
```
Example
-------
```powershell
PS> ./calculate-BMI.ps1
```
Notes
-----
Author: Markus Fleschutz | License: CC0
Related Links
-------------
https://github.com/fleschutz/PowerShell
Script Content
--------------
```powershell
<#
.SYNOPSIS
Calculate the BMI
.DESCRIPTION
This PowerShell script calculates the BMI.
.EXAMPLE
PS> ./calculate-BMI.ps1
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
#requires -version 5.1
try {
[float]$height = Read-Host("Enter your height in m ")
[float]$weight = Read-Host("Enter your weight in kg")
$BMI = $weight / ($height * $height)
"Your BMI is $BMI, for adults the WHO regards <16 as Underweight (severe thinness), 16-17 as Underweight (moderate thinness), 17-18.5 as Underweight (mild thinness), 18.5-25 as Normal range, 25-30 as Overweight (pre-obese), 30-35 as Obese (class I), 35-40 as Obese (class II), and >=40 as Obese (class III)."
exit 0 # success
} catch {
"⚠️ ERROR: $($Error[0]) in script line $($_.InvocationInfo.ScriptLineNumber)."
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
$path = Resolve-Path "~/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup" $path = Resolve-Path "~/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup"
if (-not(Test-Path "$path" -pathType container)) { if (-not(Test-Path "$path" -pathType container)) {
@ -60,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 08/06/2025 15:18:20)*

View File

@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
if ($IsLinux) { throw "Sorry, Windows only" } if ($IsLinux) { throw "Sorry, Windows only" }
@ -65,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 08/06/2025 15:18:20)*

View File

@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
if ($IsLinux -or $IsMacOS) { if ($IsLinux -or $IsMacOS) {
if (-not(Test-Path "~/Desktop" -pathType container)) { if (-not(Test-Path "~/Desktop" -pathType container)) {
@ -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 08/06/2025 15:18:20)*

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 current working directory to the documents folder.
Parameters Parameters
---------- ----------
@ -36,7 +36,7 @@ Script Content
.SYNOPSIS .SYNOPSIS
Sets the working dir to the documents folder Sets the working dir to the documents folder
.DESCRIPTION .DESCRIPTION
This PowerShell script sets the current working directory to the documents folder. This PowerShell script changes the current working directory to the documents folder.
.EXAMPLE .EXAMPLE
PS> ./cd-docs.ps1 PS> ./cd-docs.ps1
📂C:\Users\Markus\Documents with 3 files and 0 folders entered. 📂C:\Users\Markus\Documents with 3 files and 0 folders entered.
@ -46,10 +46,12 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
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 "Your home directory has no 'Documents' folder yet"
} }
$path = Resolve-Path "~/Documents" $path = Resolve-Path "~/Documents"
} else { } else {
@ -64,9 +66,9 @@ try {
"📂$path with $($files.Count) files and $($folders.Count) folders entered." "📂$path with $($files.Count) files and $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
if ($IsLinux -or $IsMacOS) { if ($IsLinux -or $IsMacOS) {
if (-not(Test-Path "~/Downloads" -pathType container)) { if (-not(Test-Path "~/Downloads" -pathType container)) {
@ -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 08/06/2025 15:18:20)*

View File

@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
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?"
@ -62,4 +64,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -1,7 +1,7 @@
The *cd-etc.ps1* Script The *cd-etc.ps1* Script
=========================== ===========================
This PowerShell script changes the working directory to the /etc directory. This PowerShell script changes the current working directory to the /etc directory.
Parameters Parameters
---------- ----------
@ -16,8 +16,8 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-etc PS> ./cd-etc.ps1
📂C:\Windows\System32\drivers\etc (has 5 files and 0 folders) 📂C:\Windows\System32\drivers\etc with 5 files and 0 folders entered.
``` ```
@ -36,16 +36,18 @@ Script Content
.SYNOPSIS .SYNOPSIS
Changes to the /etc directory Changes to the /etc directory
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the /etc directory. This PowerShell script changes the current working directory to the /etc directory.
.EXAMPLE .EXAMPLE
PS> ./cd-etc PS> ./cd-etc.ps1
📂C:\Windows\System32\drivers\etc (has 5 files and 0 folders) 📂C:\Windows\System32\drivers\etc with 5 files and 0 folders entered.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
if ($IsLinux -or $IsMacOS) { if ($IsLinux -or $IsMacOS) {
$path = "/etc" $path = "/etc"
@ -58,12 +60,12 @@ 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 with $($files.Count) files and $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
$path = [Environment]::GetFolderPath('Fonts') $path = [Environment]::GetFolderPath('Fonts')
if (-not(Test-Path "$path" -pathType container)) { if (-not(Test-Path "$path" -pathType container)) {
@ -61,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 08/06/2025 15:18:20)*

View File

@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
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 "~"
@ -60,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 08/06/2025 15:18:20)*

View File

@ -16,7 +16,7 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-jenkins PS> ./cd-jenkins.ps1
📂C:\Users\Markus\.jenkins entered (has 2 files and 21 folders) 📂C:\Users\Markus\.jenkins entered (has 2 files and 21 folders)
``` ```
@ -38,7 +38,7 @@ Script Content
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the Jenkins home directory. This PowerShell script changes the working directory to the Jenkins home directory.
.EXAMPLE .EXAMPLE
PS> ./cd-jenkins PS> ./cd-jenkins.ps1
📂C:\Users\Markus\.jenkins entered (has 2 files and 21 folders) 📂C:\Users\Markus\.jenkins entered (has 2 files and 21 folders)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
if (Test-Path "~/.jenkins" -pathType container) { if (Test-Path "~/.jenkins" -pathType container) {
$path = "~/.jenkins" $path = "~/.jenkins"
@ -65,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 08/06/2025 15:18:20)*

View File

@ -1,19 +1,34 @@
The *cd-logs.ps1* Script The *cd-logs.ps1* Script
=========================== ===========================
cd-logs.ps1 This PowerShell script changes the current working directory to the logs directory.
Parameters Parameters
---------- ----------
```powershell ```powershell
/Repos/PowerShell/scripts/cd-logs.ps1 [<CommonParameters>]
[<CommonParameters>] [<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable. WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
``` ```
Example
-------
```powershell
PS> ./cd-logs.ps1
📂/var/logs with 3 files and 2 folders entered.
```
Notes
-----
Author: Markus Fleschutz | License: CC0
Related Links
-------------
https://github.com/fleschutz/PowerShell
Script Content Script Content
-------------- --------------
```powershell ```powershell
@ -23,14 +38,16 @@ Script Content
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the current working directory to the logs directory. This PowerShell script changes the current working directory to the logs directory.
.EXAMPLE .EXAMPLE
PS> ./cd-logs PS> ./cd-logs.ps1
📂/var/logs entered (has 3 files and 2 subfolders) 📂/var/logs with 3 files and 2 folders entered.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
function GetLogsDir { function GetLogsDir {
if ($IsLinux -or $IsMacOS) { return "/var/logs" } if ($IsLinux -or $IsMacOS) { return "/var/logs" }
$WinDir = [System.Environment]::GetFolderPath('Windows') $WinDir = [System.Environment]::GetFolderPath('Windows')
@ -42,12 +59,12 @@ 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) subfolders)" "📂$path with $($files.Count) files and $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
if ($IsLinux) { if ($IsLinux) {
if (-not(Test-Path "~/Music/" -pathType container)) { if (-not(Test-Path "~/Music/" -pathType container)) {
@ -64,9 +66,9 @@ try {
"📂$path with $($folders.Count) folders and $($files.Count) files entered." "📂$path with $($folders.Count) folders and $($files.Count) files entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -16,8 +16,8 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-nextcloud PS> ./cd-nextcloud.ps1
📂C:\Users\Markus\NextCloud entered (has 2 files and 0 folders) 📂C:\Users\Markus\NextCloud with 2 files and 0 folders entered.
``` ```
@ -38,14 +38,16 @@ Script Content
.DESCRIPTION .DESCRIPTION
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.ps1
📂C:\Users\Markus\NextCloud entered (has 2 files and 0 folders) 📂C:\Users\Markus\NextCloud with 2 files and 0 folders entered.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
if (-not(Test-Path "~/NextCloud" -pathType container)) { if (-not(Test-Path "~/NextCloud" -pathType container)) {
throw "No 'NextCloud' folder in your home directory - is NextCloud installed?" throw "No 'NextCloud' folder in your home directory - is NextCloud installed?"
@ -54,12 +56,12 @@ 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 with $($files.Count) files and $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
if (-not(Test-Path "~/OneDrive" -pathType container)) { if (-not(Test-Path "~/OneDrive" -pathType container)) {
throw "No 'OneDrive' folder in your home directory - is OneDrive installed?" throw "No 'OneDrive' folder in your home directory - is OneDrive installed?"
@ -57,9 +59,9 @@ try {
"📂$path with $($files.Count) files and $($folders.Count) folders entered." "📂$path with $($files.Count) files and $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

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 current working directory to the user's pictures folder.
Parameters Parameters
---------- ----------
@ -36,7 +36,7 @@ Script Content
.SYNOPSIS .SYNOPSIS
Sets the working dir to the user's pictures folder Sets the working dir 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 current working directory to the user's pictures folder.
.EXAMPLE .EXAMPLE
PS> ./cd-pics.ps1 PS> ./cd-pics.ps1
📂C:\Users\Markus\Pictures with 7 files and 0 folders entered. 📂C:\Users\Markus\Pictures with 7 files and 0 folders entered.
@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
if ($IsLinux) { if ($IsLinux) {
if (-not(Test-Path "~/Pictures" -pathType container)) { if (-not(Test-Path "~/Pictures" -pathType container)) {
@ -64,9 +66,9 @@ try {
"📂$path with $($files.Count) files and $($folders.Count) folders entered." "📂$path with $($files.Count) files and $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

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 current working directory to the Public folder.
Parameters Parameters
---------- ----------
@ -36,7 +36,7 @@ Script Content
.SYNOPSIS .SYNOPSIS
Sets the working dir to the Public folder Sets the working dir to the Public folder
.DESCRIPTION .DESCRIPTION
This PowerShell script sets the current working directory to the Public folder. This PowerShell script changes the current working directory to the Public folder.
.EXAMPLE .EXAMPLE
PS> ./cd-public.ps1 PS> ./cd-public.ps1
📂C:\Users\Public with 2 files and 3 folders entered. 📂C:\Users\Public with 2 files and 3 folders entered.
@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
if ($IsLinux) { if ($IsLinux) {
if (-not(Test-Path "~/Public" -pathType container)) { if (-not(Test-Path "~/Public" -pathType container)) {
@ -64,9 +66,9 @@ try {
"📂$path with $($files.Count) files and $($folders.Count) folders entered." "📂$path with $($files.Count) files and $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -1,7 +1,7 @@
The *cd-recent.ps1* Script The *cd-recent.ps1* Script
=========================== ===========================
This PowerShell script changes the working directory to the 'recent' folder. This PowerShell script changes the current working directory to the 'recent' folder.
Parameters Parameters
---------- ----------
@ -16,8 +16,8 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-recent PS> ./cd-recent.ps1
📂C:\Users\Markus\AppData\Roaming\Microsoft\Windows\Recent entered (has 2 files and 3 subfolders) 📂C:\Users\Markus\AppData\Roaming\Microsoft\Windows\Recent with 2 files and 3 folders entered.
``` ```
@ -36,30 +36,31 @@ Script Content
.SYNOPSIS .SYNOPSIS
Sets the working directory to the 'recent' folder Sets the working directory to the 'recent' folder
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the 'recent' folder. This PowerShell script changes the current working directory to the 'recent' folder.
.EXAMPLE .EXAMPLE
PS> ./cd-recent PS> ./cd-recent.ps1
📂C:\Users\Markus\AppData\Roaming\Microsoft\Windows\Recent entered (has 2 files and 3 subfolders) 📂C:\Users\Markus\AppData\Roaming\Microsoft\Windows\Recent with 2 files and 3 folders entered.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
$path = [Environment]::GetFolderPath('Recent') $path = [Environment]::GetFolderPath('Recent')
if (-not(Test-Path "$path" -pathType container)) { if (-not(Test-Path "$path" -pathType container)) { throw "No recent folder at $path" }
throw "No recent 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 entered (has $($files.Count) files and $($folders.Count) subfolders)" "📂$path with $($files.Count) files and $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -1,36 +1,53 @@
The *cd-recycle-bin.ps1* Script The *cd-recycle-bin.ps1* Script
=========================== ===========================
cd-recycle-bin.ps1 This PowerShell script changes the current working directory to the user's recycle bin folder.
Parameters Parameters
---------- ----------
```powershell ```powershell
/Repos/PowerShell/scripts/cd-recycle-bin.ps1 [<CommonParameters>]
[<CommonParameters>] [<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable. WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
``` ```
Example
-------
```powershell
PS> ./cd-recycle-bin.ps1
📂C:\$Recycle.Bin\S-1-5-21-123404-23309-294260-1001 with 2 files and 0 folders entered.
```
Notes
-----
Author: Markus Fleschutz | License: CC0
Related Links
-------------
https://github.com/fleschutz/PowerShell
Script Content Script Content
-------------- --------------
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working directory to the recycle bin folder Sets the working dir to the recycle bin folder
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the user's recycle bin folder. This PowerShell script changes the current working directory to the user's recycle bin folder.
.EXAMPLE .EXAMPLE
PS> ./cd-recycle-bin PS> ./cd-recycle-bin.ps1
📂C:\$Recycle.Bin\S-1-5-21-123404-23309-294260-1001 entered (has 2 files and 0 subfolders) 📂C:\$Recycle.Bin\S-1-5-21-123404-23309-294260-1001 with 2 files and 0 folders entered.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
function GetCurrentUserSID { [CmdletBinding()] param() function GetCurrentUserSID { [CmdletBinding()] param()
Add-Type -AssemblyName System.DirectoryServices.AccountManagement Add-Type -AssemblyName System.DirectoryServices.AccountManagement
return ([System.DirectoryServices.AccountManagement.UserPrincipal]::Current).SID.Value return ([System.DirectoryServices.AccountManagement.UserPrincipal]::Current).SID.Value
@ -49,12 +66,12 @@ 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) subfolders)" "📂$path with $($files.Count) files and $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -1,7 +1,7 @@
The *cd-repo.ps1* Script The *cd-repo.ps1* Script
=========================== ===========================
This PowerShell script changes the working directory to the given local Git repository. This PowerShell script changes the current working directory to the given local Git repository.
Parameters Parameters
---------- ----------
@ -46,7 +46,7 @@ Script Content
.SYNOPSIS .SYNOPSIS
Sets the working directory to a repo Sets the working directory to a repo
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the given local Git repository. This PowerShell script changes the current working directory to the given local Git repository.
.PARAMETER folderName .PARAMETER folderName
Specifies the folder name of the Git repository Specifies the folder name of the Git repository
.EXAMPLE .EXAMPLE
@ -58,6 +58,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
param([string]$folderName = "") param([string]$folderName = "")
try { try {
@ -85,9 +87,9 @@ try {
& git status --branch --short & git status --branch --short
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -1,7 +1,7 @@
The *cd-repos.ps1* Script The *cd-repos.ps1* Script
=========================== ===========================
This PowerShell script changes the working directory to the folder for Git repositories. This PowerShell script changes the current working directory to the folder for Git repositories.
Parameters Parameters
---------- ----------
@ -36,7 +36,7 @@ Script Content
.SYNOPSIS .SYNOPSIS
Sets the working dir to the repos folder Sets the working dir to the repos folder
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the folder for Git repositories. This PowerShell script changes the current 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 with 33 folders entered.
@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
if (Test-Path "~/Repos" -pathType container) { $path = "~/Repos" if (Test-Path "~/Repos" -pathType container) { $path = "~/Repos"
} elseif (Test-Path "~/repos" -pathType container) { $path = "~/repos" } elseif (Test-Path "~/repos" -pathType container) { $path = "~/repos"
@ -64,9 +66,9 @@ try {
"📂$path with $($folders.Count) folders entered." "📂$path with $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
if ($IsLinux -or $IsMacOS) { $path = "/" } else { $path = "C:\" } if ($IsLinux -or $IsMacOS) { $path = "/" } else { $path = "C:\" }
Set-Location "$path" Set-Location "$path"
@ -54,9 +56,9 @@ try {
"📂$path with $($folders.Count) folders and $($files.Count) files entered." "📂$path with $($folders.Count) folders and $($files.Count) files entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -1,19 +1,34 @@
The *cd-screenshots.ps1* Script The *cd-screenshots.ps1* Script
=========================== ===========================
cd-screenshots.ps1 This PowerShell script sets the current working directory to the user's screenshots folder.
Parameters Parameters
---------- ----------
```powershell ```powershell
/Repos/PowerShell/scripts/cd-screenshots.ps1 [<CommonParameters>]
[<CommonParameters>] [<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable. WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
``` ```
Example
-------
```powershell
PS> ./cd-screenshots.ps1
📂C:\Users\Markus\Pictures\Screenshots with 7 files and 0 folders entered.
```
Notes
-----
Author: Markus Fleschutz | License: CC0
Related Links
-------------
https://github.com/fleschutz/PowerShell
Script Content Script Content
-------------- --------------
```powershell ```powershell
@ -31,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
function GetScreenshotsFolder { function GetScreenshotsFolder {
if ($IsLinux) { if ($IsLinux) {
if (-not(Test-Path "~/Pictures" -pathType container)) { throw "No 'Pictures' folder in your home directory yet" } if (-not(Test-Path "~/Pictures" -pathType container)) { throw "No 'Pictures' folder in your home directory yet" }
@ -52,9 +69,9 @@ try {
"📂$path with $($files.Count) files and $($folders.Count) folders entered." "📂$path with $($files.Count) files and $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -1,7 +1,7 @@
The *cd-scripts.ps1* Script The *cd-scripts.ps1* Script
=========================== ===========================
This PowerShell script changes the working directory to the PowerShell scripts folder. This PowerShell script changes the currrent working directory to the PowerShell scripts folder.
Parameters Parameters
---------- ----------
@ -36,7 +36,7 @@ Script Content
.SYNOPSIS .SYNOPSIS
Sets the working directory to the PowerShell scripts folder Sets the working directory to the PowerShell scripts folder
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the PowerShell scripts folder. This PowerShell script changes the currrent 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 with 655 scripts entered.
@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
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 scripts folder at: $path" }
@ -54,9 +56,9 @@ try {
"📂$path with $($files.Count) scripts entered." "📂$path with $($files.Count) scripts entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

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 current working directory to the user's secure shell (SSH) folder.
Parameters Parameters
---------- ----------
@ -36,7 +36,7 @@ Script Content
.SYNOPSIS .SYNOPSIS
Sets the working dir to the SSH folder Sets the working dir 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 current 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 with 4 files entered.
@ -46,10 +46,12 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
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 '.ssh' folder in your home directory yet - Please install SSH."
} }
$path = Resolve-Path "$path" $path = Resolve-Path "$path"
Set-Location "$path" Set-Location "$path"
@ -57,9 +59,9 @@ try {
"📂$path with $($files.Count) files entered." "📂$path with $($files.Count) files entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -1,7 +1,7 @@
The *cd-sync.ps1* Script The *cd-sync.ps1* Script
=========================== ===========================
This PowerShell script changes the working directory to the user's Syncthing folder. This PowerShell script changes the current working directory to the user's Syncthing folder.
Parameters Parameters
---------- ----------
@ -17,7 +17,7 @@ Example
------- -------
```powershell ```powershell
PS> ./cd-sync.ps1 PS> ./cd-sync.ps1
📂C:\Users\Markus\Sync entered (has 2 files and 0 folders) 📂C:\Users\Markus\Sync with 2 files and 0 folders entered.
``` ```
@ -36,30 +36,32 @@ Script Content
.SYNOPSIS .SYNOPSIS
Sets the working directory to the user's Sync folder Sets the working directory to the user's Sync folder
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the user's Syncthing folder. This PowerShell script changes the current working directory to the user's Syncthing folder.
.EXAMPLE .EXAMPLE
PS> ./cd-sync.ps1 PS> ./cd-sync.ps1
📂C:\Users\Markus\Sync entered (has 2 files and 0 folders) 📂C:\Users\Markus\Sync with 2 files and 0 folders entered.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
if (-not(Test-Path "~/Sync" -pathType container)) { if (-not(Test-Path "~/Sync" -pathType container)) {
throw "No 'Sync' folder in your home directory - is Syncthing installed?" throw "No 'Sync' folder in your home directory yet - Please install Syncthing."
} }
$path = Resolve-Path "~/Sync" $path = Resolve-Path "~/Sync"
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 with $($files.Count) files and $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -1,19 +1,34 @@
The *cd-temp.ps1* Script The *cd-temp.ps1* Script
=========================== ===========================
cd-temp.ps1 This PowerShell script changes the current working directory to the temporary folder.
Parameters Parameters
---------- ----------
```powershell ```powershell
/Repos/PowerShell/scripts/cd-temp.ps1 [<CommonParameters>]
[<CommonParameters>] [<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable. WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
``` ```
Example
-------
```powershell
PS> ./cd-temp.ps1
📂C:\Users\Markus\AppData\Local\Temp with 2 files and 3 subfolders entered.
```
Notes
-----
Author: Markus Fleschutz | License: CC0
Related Links
-------------
https://github.com/fleschutz/PowerShell
Script Content Script Content
-------------- --------------
```powershell ```powershell
@ -21,37 +36,37 @@ Script Content
.SYNOPSIS .SYNOPSIS
Sets the working directory to the temporary folder Sets the working directory to the temporary folder
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the temporary folder. This PowerShell script changes the current working directory to the temporary folder.
.EXAMPLE .EXAMPLE
PS> ./cd-temp PS> ./cd-temp.ps1
📂C:\Users\Markus\AppData\Local\Temp (has 2 files and 3 subfolders) 📂C:\Users\Markus\AppData\Local\Temp with 2 files and 3 subfolders entered.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
function GetTempDir { function GetTempDir {
if ("$env:TEMP" -ne "") { return "$env:TEMP" } if ("$env:TEMP" -ne "") { return "$env:TEMP" }
if ("$env:TMP" -ne "") { return "$env:TMP" } if ("$env:TMP" -ne "") { return "$env:TMP" }
if ($IsLinux) { return "/tmp" } if ($IsLinux -or $IsMacOS) { return "/tmp" }
return "C:\Temp" return "C:\Temp"
} }
try { try {
$path = GetTempDir $path = GetTempDir
if (-not(Test-Path "$path" -pathType container)) { throw if (-not(Test-Path "$path" -pathType container)) { throw "No temporary folder at: $path" }
"No temporary 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 entered (has $($files.Count) files and $($folders.Count) subfolders)" "📂$path with $($files.Count) files and $($folders.Count) subfolders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
if ($IsLinux) { if ($IsLinux) {
if (-not(Test-Path "~/Templates" -pathType container)) { if (-not(Test-Path "~/Templates" -pathType container)) {
@ -64,9 +66,9 @@ try {
"📂$path with $($files.Count) files and $($folders.Count) folders entered." "📂$path with $($files.Count) files and $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -1,36 +1,53 @@
The *cd-trash.ps1* Script The *cd-trash.ps1* Script
=========================== ===========================
cd-trash.ps1 This PowerShell script changes the current working directory to the user's trash folder.
Parameters Parameters
---------- ----------
```powershell ```powershell
/Repos/PowerShell/scripts/cd-trash.ps1 [<CommonParameters>]
[<CommonParameters>] [<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable. WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
``` ```
Example
-------
```powershell
PS> ./cd-trash.ps1
📂C:\$Recycle.Bin\S-1-5-21-123404-23309-294260-1001 with 4 files and 0 folders entered.
```
Notes
-----
Author: Markus Fleschutz | License: CC0
Related Links
-------------
https://github.com/fleschutz/PowerShell
Script Content Script Content
-------------- --------------
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working directory to the trash folder Sets the working dir to the trash folder
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the user's trash folder. This PowerShell script changes the current working directory to the user's trash folder.
.EXAMPLE .EXAMPLE
PS> ./cd-trash PS> ./cd-trash.ps1
📂C:\$Recycle.Bin\S-1-5-21-123404-23309-294260-1001 entered (has 4 files and 0 subfolders) 📂C:\$Recycle.Bin\S-1-5-21-123404-23309-294260-1001 with 4 files and 0 folders entered.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
function GetCurrentUserSID { [CmdletBinding()] param() function GetCurrentUserSID { [CmdletBinding()] param()
Add-Type -AssemblyName System.DirectoryServices.AccountManagement Add-Type -AssemblyName System.DirectoryServices.AccountManagement
return ([System.DirectoryServices.AccountManagement.UserPrincipal]::Current).SID.Value return ([System.DirectoryServices.AccountManagement.UserPrincipal]::Current).SID.Value
@ -49,12 +66,12 @@ 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) subfolders)" "📂$path with $($files.Count) files and $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -1,7 +1,7 @@
The *cd-up.ps1* Script The *cd-up.ps1* Script
=========================== ===========================
This PowerShell script changes the working directory to one directory level up. This PowerShell script changes the current working directory to one directory level up.
Parameters Parameters
---------- ----------
@ -16,7 +16,7 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> .\cd-up PS> .\cd-up.ps1
📂C:\Users 📂C:\Users
``` ```
@ -36,9 +36,9 @@ Script Content
.SYNOPSIS .SYNOPSIS
Sets the working directory to one level up Sets the working directory to one level up
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to one directory level up. This PowerShell script changes the current working directory to one directory level up.
.EXAMPLE .EXAMPLE
PS> .\cd-up PS> .\cd-up.ps1
📂C:\Users 📂C:\Users
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
$path = Resolve-Path ".." $path = Resolve-Path ".."
if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" } if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" }
@ -53,9 +55,9 @@ try {
"📂$path" "📂$path"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -1,7 +1,7 @@
The *cd-up2.ps1* Script The *cd-up2.ps1* Script
=========================== ===========================
This PowerShell script changes the working directory to two directory level up. This PowerShell script changes the current working directory to two directory level up.
Parameters Parameters
---------- ----------
@ -16,7 +16,7 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-up2 PS> ./cd-up2.ps1
📂C:\ 📂C:\
``` ```
@ -34,11 +34,11 @@ Script Content
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working directory to two directory levels up Sets the working directory 2 directory levels up
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to two directory level up. This PowerShell script changes the current working directory to two directory level up.
.EXAMPLE .EXAMPLE
PS> ./cd-up2 PS> ./cd-up2.ps1
📂C:\ 📂C:\
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
$path = Resolve-Path "../.." $path = Resolve-Path "../.."
if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" } if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" }
@ -53,9 +55,9 @@ try {
"📂$path" "📂$path"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -1,7 +1,7 @@
The *cd-up3.ps1* Script The *cd-up3.ps1* Script
=========================== ===========================
This PowerShell script changes the working directory to three directory levels up. This PowerShell script changes the current working directory to three directory levels up.
Parameters Parameters
---------- ----------
@ -16,7 +16,7 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-up3 PS> ./cd-up3.ps1
📂C:\ 📂C:\
``` ```
@ -34,11 +34,11 @@ Script Content
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working directory to three directory levels up Sets the working directory 3 directory levels up
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to three directory levels up. This PowerShell script changes the current working directory to three directory levels up.
.EXAMPLE .EXAMPLE
PS> ./cd-up3 PS> ./cd-up3.ps1
📂C:\ 📂C:\
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
$path = Resolve-Path "../../.." $path = Resolve-Path "../../.."
if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" } if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" }
@ -53,9 +55,9 @@ try {
"📂$path" "📂$path"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -1,7 +1,7 @@
The *cd-up4.ps1* Script The *cd-up4.ps1* Script
=========================== ===========================
This PowerShell script changes the working directory to four directory levels up. This PowerShell script changes the current working directory to four directory levels up.
Parameters Parameters
---------- ----------
@ -16,7 +16,7 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-up4 PS> ./cd-up4.ps1
📂C:\ 📂C:\
``` ```
@ -34,11 +34,11 @@ Script Content
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working directory to four directory levels up Sets the working directory 4 directory levels up
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to four directory levels up. This PowerShell script changes the current working directory to four directory levels up.
.EXAMPLE .EXAMPLE
PS> ./cd-up4 PS> ./cd-up4.ps1
📂C:\ 📂C:\
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
@ -46,6 +46,8 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
$path = Resolve-Path "../../../.." $path = Resolve-Path "../../../.."
if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" } if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" }
@ -53,9 +55,9 @@ try {
"📂$path" "📂$path"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -46,19 +46,20 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
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"
$folders = Get-ChildItem $path -attributes Directory $folders = Get-ChildItem $path -attributes Directory
"📂$path with $($folders.Count) folders entered." "📂$path with $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -16,8 +16,8 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-videos PS> ./cd-videos.ps1
📂C:\Users\Markus\Videos entered (has 3 files and 0 subfolders) 📂C:\Users\Markus\Videos with 3 files and 0 folders entered.
``` ```
@ -38,14 +38,16 @@ Script Content
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the user's videos folder. This PowerShell script changes the working directory to the user's videos folder.
.EXAMPLE .EXAMPLE
PS> ./cd-videos PS> ./cd-videos.ps1
📂C:\Users\Markus\Videos entered (has 3 files and 0 subfolders) 📂C:\Users\Markus\Videos with 3 files and 0 folders entered.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
if ($IsLinux) { if ($IsLinux) {
$path = Resolve-Path "~/Videos" $path = Resolve-Path "~/Videos"
@ -58,12 +60,12 @@ 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) subfolders)" "📂$path with $($files.Count) files and $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

View File

@ -1,7 +1,7 @@
The *cd-windows.ps1* Script The *cd-windows.ps1* Script
=========================== ===========================
This PowerShell script changes the working directory to the Windows directory. This PowerShell script sets the current working directory to the Windows directory.
Parameters Parameters
---------- ----------
@ -16,8 +16,8 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./cd-windows PS> ./cd-windows.ps1
📂C:\Windows entered (has 7 files and 42 folders) 📂C:\Windows with 7 files and 42 folders entered.
``` ```
@ -34,32 +34,35 @@ Script Content
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working directory to the Windows directory Sets the working dir to the Windows directory
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the Windows directory. This PowerShell script sets the current working directory to the Windows directory.
.EXAMPLE .EXAMPLE
PS> ./cd-windows PS> ./cd-windows.ps1
📂C:\Windows entered (has 7 files and 42 folders) 📂C:\Windows with 7 files and 42 folders entered.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#requires -version 5.1
try { try {
if ($IsLinux -or $IsMacOS) { throw "This script requires a Windows operating system" }
$path = Resolve-Path "$env:WINDIR" $path = Resolve-Path "$env:WINDIR"
if (-not(Test-Path "$path" -pathType container)) { if (-not(Test-Path "$path" -pathType container)) { throw "No Windows directory at $path" }
throw "No Windows 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 with $($files.Count) files and $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

View File

@ -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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:20)*

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 08/06/2025 15:18:21)*

View File

@ -6,9 +6,9 @@ This PowerShell script verifies the integrity of a local Git repository and perf
Parameters Parameters
---------- ----------
```powershell ```powershell
/Repos/PowerShell/scripts/check-repo.ps1 [[-pathToRepo] <String>] [<CommonParameters>] /Repos/PowerShell/scripts/check-repo.ps1 [[-path] <String>] [<CommonParameters>]
-pathToRepo <String> -path <String>
Specifies the file path to the local Git repository (current working directory by default) Specifies the file path to the local Git repository (current working directory by default)
Required? false Required? false
@ -51,10 +51,10 @@ Script Content
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Checks a Git repository Checks a Git repo
.DESCRIPTION .DESCRIPTION
This PowerShell script verifies the integrity of a local Git repository and performs maintenance tasks. This PowerShell script verifies the integrity of a local Git repository and performs maintenance tasks.
.PARAMETER pathToRepo .PARAMETER path
Specifies the file path to the local Git repository (current working directory by default) Specifies the file path to the local Git repository (current working directory by default)
.EXAMPLE .EXAMPLE
PS> ./check-repo.ps1 C:\MyRepo PS> ./check-repo.ps1 C:\MyRepo
@ -72,7 +72,7 @@ Script Content
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
param([string]$pathToRepo = "$PWD") param([string]$path = "$PWD")
try { try {
$stopWatch = [system.diagnostics.stopwatch]::startNew() $stopWatch = [system.diagnostics.stopwatch]::startNew()
@ -82,7 +82,7 @@ try {
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" } if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Host "⏳ (2/10) Checking local repository... " -noNewline Write-Host "⏳ (2/10) Checking local repository... " -noNewline
$FullPath = Resolve-Path "$pathToRepo" $FullPath = Resolve-Path "$path"
if (!(Test-Path "$FullPath" -pathType Container)) { throw "Can't access folder: $FullPath" } if (!(Test-Path "$FullPath" -pathType Container)) { throw "Can't access folder: $FullPath" }
"$FullPath" "$FullPath"
@ -122,12 +122,12 @@ try {
$repoDirName = (Get-Item "$FullPath").Name $repoDirName = (Get-Item "$FullPath").Name
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds [int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ Checked 📂$repoDirName repo in $($elapsed)s." "✅ Repo '$repoDirName' has been checked in $($elapsed)s."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ ERROR: $($Error[0]) in script line $($_.InvocationInfo.ScriptLineNumber)"
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 08/06/2025 15:18:21)*

View File

@ -28,9 +28,9 @@ Example
```powershell ```powershell
PS> ./check-repos.ps1 C:\Repos PS> ./check-repos.ps1 C:\Repos
Checking parent folder 📂C:\Repos... 16 subfolders Checking parent folder 📂C:\Repos... 16 subfolders
Checking 📂rust repository (1/16)... Checking repo 'rust' (1/16)...
... ...
Checked all 16 Git repos in 📂C:\Repos in 356s. 16 Git repos checked at 📂C:\Repos in 356s.
``` ```
@ -55,9 +55,9 @@ Script Content
.EXAMPLE .EXAMPLE
PS> ./check-repos.ps1 C:\Repos PS> ./check-repos.ps1 C:\Repos
⏳ Checking parent folder 📂C:\Repos... 16 subfolders ⏳ Checking parent folder 📂C:\Repos... 16 subfolders
⏳ Checking 📂rust repository (1/16)... ⏳ Checking repo 'rust' (1/16)...
... ...
Checked all 16 Git repos in 📂C:\Repos in 356s. ✅ 16 Git repos checked at 📂C:\Repos in 356s.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -78,13 +78,13 @@ try {
[int]$step = 1 [int]$step = 1
foreach ($folder in $folders) { foreach ($folder in $folders) {
"`n⏳ Checking 📂$folder repository ($step/$numFolders)..." "`n⏳ Checking repo '$folder' ($step/$numFolders)..."
& "$PSScriptRoot/check-repo.ps1" "$folder" & "$PSScriptRoot/check-repo.ps1" "$folder"
$step++ $step++
} }
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds [int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ Checked all $numFolders Git repos in 📂$parentDir in $($elapsed)s." "✅ $numFolders Git repos checked at 📂$parentDir in $($elapsed)s."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -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 08/06/2025 15:18:21)*

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 08/06/2025 15:18:21)*

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 08/06/2025 15:18:21)*

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 08/06/2025 15:18:21)*

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 08/06/2025 15:18:21)*

View File

@ -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 08/06/2025 15:18:21)*

View File

@ -6,10 +6,10 @@ This PowerShell script checks all symbolic links in a directory tree. It returns
Parameters Parameters
---------- ----------
```powershell ```powershell
/Repos/PowerShell/scripts/check-symlinks.ps1 [[-Folder] <String>] [<CommonParameters>] /Repos/PowerShell/scripts/check-symlinks.ps1 [[-path] <String>] [<CommonParameters>]
-Folder <String> -path <String>
Specifies the path to the folder Specifies the file path to the directory tree
Required? false Required? false
Position? 1 Position? 1
@ -26,9 +26,9 @@ Parameters
Example Example
------- -------
```powershell ```powershell
PS> ./check-symlinks D:\ PS> ./check-symlinks C:\Windows
Please wait while checking symlinks at: 📂D:\ ... Checking symlinks at C:\Windows including subfolders...
Found 0 broken symlinks at 📂D:\ in 60s. No symlinks at C:\Windows (took 102s).
``` ```
@ -45,29 +45,29 @@ Script Content
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Checks all symlinks in a folder Checks all symlinks in a dir tree
.DESCRIPTION .DESCRIPTION
This PowerShell script checks all symbolic links in a directory tree. It returns the number of broken symlinks as exit value. This PowerShell script checks all symbolic links in a directory tree. It returns the number of broken symlinks as exit value.
.PARAMETER folder .PARAMETER path
Specifies the path to the folder Specifies the file path to the directory tree
.EXAMPLE .EXAMPLE
PS> ./check-symlinks D:\ PS> ./check-symlinks C:\Windows
Please wait while checking symlinks at: 📂D:\ ... Checking symlinks at C:\Windows including subfolders...
Found 0 broken symlinks at 📂D:\ in 60s. No symlinks at C:\Windows (took 102s).
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
param([string]$Folder = "") param([string]$path = "")
try { try {
if ($Folder -eq "" ) { $Folder = Read-Host "Enter the path to the folder" } if ($path -eq "" ) { $path = Read-Host "Enter the file path to the directory tree" }
$stopWatch = [system.diagnostics.stopwatch]::startNew() $stopWatch = [system.diagnostics.stopwatch]::startNew()
$fullPath = Resolve-Path "$Folder" $fullPath = Resolve-Path "$path"
"⏳ Please wait while checking symlinks at 📂$fullPath ..." "⏳ Checking symlinks at $fullPath including subfolders..."
[int]$numTotal = [int]$numBroken = 0 [int]$numTotal = [int]$numBroken = 0
Get-ChildItem $fullPath -recurse | Where { $_.Attributes -match "ReparsePoint" } | ForEach-Object { Get-ChildItem $fullPath -recurse | Where { $_.Attributes -match "ReparsePoint" } | ForEach-Object {
@ -86,17 +86,19 @@ try {
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds [int]$elapsed = $stopWatch.Elapsed.TotalSeconds
if ($numTotal -eq 0) { if ($numTotal -eq 0) {
"✅ No symlink found at 📂$fullPath in $($elapsed)s." "✅ No symlinks at $fullPath (took $($elapsed)s)."
} elseif ($numBroken -eq 0) {
"✅ No broken symlinks at $fullPath ($numTotal symlinks in total, took $($elapsed)s)."
} elseif ($numBroken -eq 1) { } elseif ($numBroken -eq 1) {
"✅ Found $numBroken broken symlink at 📂$fullPath in $($elapsed)s ($numTotal symlinks in total)." "⚠️ 1 broken symlink within $fullPath ($numTotal symlinks in total, took $($elapsed)s)."
} else { } else {
"✅ Found $numBroken broken symlinks at 📂$fullPath in $($elapsed)s ($numTotal symlinks in total)." "⚠️ $numBroken broken symlinks within $fullPath ($numTotal symlinks in total, took $($elapsed)s)."
} }
exit $numBroken exit $numBroken
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ ERROR: $($Error[0]) in script line $($_.InvocationInfo.ScriptLineNumber)."
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 08/06/2025 15:18:21)*

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 08/06/2025 15:18:21)*

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 08/06/2025 15:18:21)*

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 08/06/2025 15:18:21)*

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 08/06/2025 15:18:21)*

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 08/06/2025 15:18:21)*

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 08/06/2025 15:18:21)*

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 08/06/2025 15:18:21)*

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 08/06/2025 15:18:21)*

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 08/06/2025 15:18:21)*

View File

@ -28,11 +28,11 @@ Example
------- -------
```powershell ```powershell
PS> ./clean-repo.ps1 C:\Repos\rust PS> ./clean-repo.ps1 C:\Repos\rust
(1/4) Searching for Git executable... git version 2.47.0 (1/4) Searching for Git executable... git version 2.50.0
(2/4) Checking local repository... C:\Repos\rust (2/4) Checking local repository... C:\Repos\rust
(3/4) Removing untracked files in repository... (3/4) Removing untracked files in repository...
(4/4) Removing untracked files in submodules... (4/4) Removing untracked files in submodules...
Repo 📂rust is clean now. Repo 'rust' is clean now.
``` ```
@ -57,11 +57,11 @@ Script Content
Specifies the file path to the local Git repository (current working directory by default) Specifies the file path to the local Git repository (current working directory by default)
.EXAMPLE .EXAMPLE
PS> ./clean-repo.ps1 C:\Repos\rust PS> ./clean-repo.ps1 C:\Repos\rust
⏳ (1/4) Searching for Git executable... git version 2.47.0 ⏳ (1/4) Searching for Git executable... git version 2.50.0
⏳ (2/4) Checking local repository... C:\Repos\rust ⏳ (2/4) Checking local repository... C:\Repos\rust
⏳ (3/4) Removing untracked files in repository... ⏳ (3/4) Removing untracked files in repository...
⏳ (4/4) Removing untracked files in submodules... ⏳ (4/4) Removing untracked files in submodules...
✅ Repo 📂rust is clean now. ✅ Repo 'rust' is clean now.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -71,6 +71,8 @@ Script Content
param([string]$path = "$PWD") param([string]$path = "$PWD")
try { try {
$stopWatch = [system.diagnostics.stopwatch]::startNew()
Write-Host "⏳ (1/4) Searching for Git executable... " -noNewline Write-Host "⏳ (1/4) Searching for Git executable... " -noNewline
& git --version & git --version
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" } if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
@ -91,12 +93,13 @@ try {
& git -C "$path" submodule foreach --recursive git clean -xfd -f # to delete all untracked files in the submodules & git -C "$path" submodule foreach --recursive git clean -xfd -f # to delete all untracked files in the submodules
if ($lastExitCode -ne 0) { throw "'git clean' in the submodules failed with exit code $lastExitCode" } if ($lastExitCode -ne 0) { throw "'git clean' in the submodules failed with exit code $lastExitCode" }
"✅ Repo 📂$repoName is clean now." [int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ Repo '$repoName' cleaned in $($elapsed)s."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ ERROR: $($Error[0]) in script line $($_.InvocationInfo.ScriptLineNumber)."
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 08/06/2025 15:18:21)*

View File

@ -96,9 +96,9 @@ try {
"✅ Cleaned $numFolders Git repositories under 📂$parentDirName in $($elapsed)s." "✅ Cleaned $numFolders Git repositories under 📂$parentDirName in $($elapsed)s."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ ERROR: $($Error[0]) in script line $($_.InvocationInfo.ScriptLineNumber)."
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 08/06/2025 15:18:21)*

View File

@ -1,7 +1,7 @@
The *clear-dns-cache.ps1* Script The *clear-dns-cache.ps1* Script
=========================== ===========================
This PowerShell script clears the DNS client cache of the local computer. This PowerShell script empties the DNS client cache of the local computer.
Parameters Parameters
---------- ----------
@ -17,7 +17,7 @@ Example
------- -------
```powershell ```powershell
PS> ./clear-dns-cache.ps1 PS> ./clear-dns-cache.ps1
Cleared DNS cache in 1s. DNS cache cleared in 1s.
``` ```
@ -36,10 +36,10 @@ Script Content
.SYNOPSIS .SYNOPSIS
Clears the DNS cache Clears the DNS cache
.DESCRIPTION .DESCRIPTION
This PowerShell script clears the DNS client cache of the local computer. This PowerShell script empties the DNS client cache of the local computer.
.EXAMPLE .EXAMPLE
PS> ./clear-dns-cache.ps1 PS> ./clear-dns-cache.ps1
Cleared DNS cache in 1s. ✅ DNS cache cleared in 1s.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -52,12 +52,12 @@ try {
Clear-DnsClientCache Clear-DnsClientCache
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds [int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ Cleared DNS cache in $($elapsed)s." "✅ DNS cache cleared in $($elapsed)s."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error: $($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 08/06/2025 15:18:21)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:21)*

View File

@ -119,4 +119,4 @@ try {
} }
``` ```
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)* *(page generated by convert-ps2md.ps1 as of 08/06/2025 15:18:21)*

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