Updated the manuals

This commit is contained in:
Markus Fleschutz 2025-05-12 22:04:02 +02:00
parent b3cdf19f4a
commit 09eb3d1808
651 changed files with 8362 additions and 1405 deletions

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
-Direction <String>
@ -24,6 +25,7 @@ Parameters
Position? 2
Default value Inbound
Accept pipeline input? false
Aliases
Accept wildcard characters? false
-FirewallProfile <Array>
@ -32,6 +34,7 @@ Parameters
Position? 3
Default value @("Domain", "Private")
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -113,4 +116,4 @@ try {
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -71,4 +72,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -1,7 +1,7 @@
The *build-repo.ps1* Script
===========================
This PowerShell script builds a Git repository by supporting build systems such as: autogen, cmake, configure, Gradle, Imakefile, Makefile, and Meson.
This PowerShell script builds a Git repository by supporting the build systems: autogen, cmake, configure, Gradle, Imakefile, Makefile, and Meson.
Parameters
----------
@ -9,12 +9,13 @@ Parameters
/Repos/PowerShell/scripts/build-repo.ps1 [[-path] <String>] [<CommonParameters>]
-path <String>
Specifies the path to the Git repository (default is current working directory)
Specifies the path to the Git repository (current working directory by default)
Required? false
Position? 1
Default value "$PWD"
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -26,9 +27,9 @@ Example
-------
```powershell
PS> ./build-repo.ps1 C:\Repos\ninja
⏳ Building 📂ninja using CMakeLists.txt into 📂ninja/_Build_Results...
⏳ Building 📂ninja by using CMake...
...
✅ Built 📂ninja repository in 47 sec.
✅ Build of 📂ninja succeeded in 47s, results in: 📂C:\Repos\ninja\_results
```
@ -45,16 +46,16 @@ Script Content
```powershell
<#
.SYNOPSIS
Builds a repository
Builds a repo
.DESCRIPTION
This PowerShell script builds a Git repository by supporting build systems such as: autogen, cmake, configure, Gradle, Imakefile, Makefile, and Meson.
This PowerShell script builds a Git repository by supporting the build systems: autogen, cmake, configure, Gradle, Imakefile, Makefile, and Meson.
.PARAMETER path
Specifies the path to the Git repository (default is current working directory)
Specifies the path to the Git repository (current working directory by default)
.EXAMPLE
PS> ./build-repo.ps1 C:\Repos\ninja
⏳ Building 📂ninja using CMakeLists.txt into 📂ninja/_Build_Results...
⏳ Building 📂ninja by using CMake...
...
✅ Built 📂ninja repository in 47 sec.
✅ Build of 📂ninja succeeded in 47s, results in: 📂C:\Repos\ninja\_results
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -63,114 +64,114 @@ Script Content
param([string]$path = "$PWD")
function BuildInDir([string]$path) {
function BuildFolder([string]$path) {
$dirName = (Get-Item "$path").Name
if (Test-Path "$path/CMakeLists.txt" -pathType leaf) {
"⏳ (1/4) Building 📂$dirName by using CMake into 📂$dirName/_Build_Results..."
if (-not(Test-Path "$path/_Build_Results/" -pathType container)) {
& mkdir "$path/_Build_Results/"
"⏳ (1/4) Building 📂$dirName by using CMake..."
$global:results = "$path/_results/"
if (-not(Test-Path $global:results -pathType container)) {
& mkdir $global:results
}
Set-Location "$path/_Build_Results/"
Set-Location $global:results
"⏳ (2/4) Executing 'cmake' to generate the Makefile..."
& cmake ..
if ($lastExitCode -ne "0") { throw "Executing 'cmake ..' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing 'cmake ..' failed with exit code $lastExitCode" }
"⏳ (3/4) Executing 'make -j4' to compile and link..."
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" }
"⏳ (4/4) Executing 'ctest -V' to perform tests (optional)..."
"⏳ (4/4) Executing 'ctest -V'... (if tests are provided)"
& ctest -V
if ($lastExitCode -ne "0") { throw "Executing 'ctest -V' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing 'ctest -V' failed with exit code $lastExitCode" }
} elseif (Test-Path "$path/autogen.sh" -pathType leaf) {
"⏳ Building 📂$dirName by using 'autogen.sh'..."
"⏳ Building 📂$dirName by executing 'autogen.sh'..."
Set-Location "$path/"
& ./autogen.sh --force
if ($lastExitCode -ne "0") { throw "Executing './autogen.sh --force' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing './autogen.sh --force' failed with exit code $lastExitCode" }
"⏳ Executing './configure'..."
& ./configure
if ($lastExitCode -ne "0") { throw "Executing './configure' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing './configure' failed with exit code $lastExitCode" }
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" }
} elseif (Test-Path "$path/configure" -pathType leaf) {
"⏳ Building 📂$dirName by using 'configure'..."
"⏳ Building 📂$dirName by executing './configure' and 'make'..."
Set-Location "$path/"
& ./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" }
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" }
& make test
if ($lastExitCode -ne "0") { throw "Executing 'make test' has failed" }
if ($lastExitCode -ne 0) { throw "Executing 'make test' failed with exit code $lastExitCode" }
} elseif (Test-Path "$path/build.gradle" -pathType leaf) {
"⏳ Building 📂$dirName by using Gradle..."
Set-Location "$path"
& gradle build
if ($lastExitCode -ne "0") { throw "Executing 'gradle build' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing 'gradle build' failed with exit code $lastExitCode" }
& gradle test
if ($lastExitCode -ne "0") { throw "Executing 'gradle test' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing 'gradle test' failed with exit code $lastExitCode" }
} elseif (Test-Path "$path/meson.build" -pathType leaf) {
"⏳ Building 📂$dirName by using Meson..."
Set-Location "$path"
& meson . build --prefix=/usr/local
if ($lastExitCode -ne "0") { throw "Executing 'meson . build' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing 'meson . build' failed with exit code $lastExitCode" }
} elseif (Test-Path "$path/Imakefile" -pathType leaf) {
"⏳ Building 📂$dirName by using Imakefile..."
Set-Location "$path/"
& xmkmf
if ($lastExitCode -ne "0") { throw "Executing 'xmkmf' has failed" }
if ($lastExitCode -ne 0) { throw "Executing 'xmkmf' failed with exit code $lastExitCode" }
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" }
} elseif (Test-Path "$path/Makefile" -pathType leaf) {
"⏳ Building 📂$dirName by using Makefile..."
Set-Location "$path"
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" }
} elseif (Test-Path "$path/makefile" -pathType leaf) {
"⏳ Building 📂$dirName by using makefile..."
Set-Location "$path"
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" }
} elseif (Test-Path "$path/compile.sh" -pathType leaf) {
"⏳ Building 📂$dirName by using 'compile.sh'..."
"⏳ Building 📂$dirName by executing 'compile.sh'..."
Set-Location "$path/"
& ./compile.sh
if ($lastExitCode -ne "0") { throw "Executing './compile.sh' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing './compile.sh' failed with exit code $lastExitCode" }
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
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) {
"⏳ Building 📂$dirName by using build.bat ..."
Set-Location "$path/attower/src/build/DevBuild/"
& ./build.bat build-all-release
if ($lastExitCode -ne "0") { throw "Executing 'build.bat build-all-release' exited with error code $lastExitCode" }
Write-Host "⏳ Building 📂$dirName by executing 'build.bat'..."
Set-Location "$path/attower/src/build/DevBuild/"
& ./build.bat build-core-release
if ($lastExitCode -ne 0) { throw "Executing 'build.bat' failed with exit code $lastExitCode" }
$global:results = "$path\attower\Executables"
} elseif (Test-Path "$path/$dirName" -pathType container) {
"⏳ No make rule found, trying subfolder 📂$($dirName)..."
BuildInDir "$path/$dirName"
BuildFolder "$path/$dirName"
} else {
Write-Warning "Sorry, no make rule applies to: 📂$dirName"
exit 0 # success
@ -179,21 +180,27 @@ function BuildInDir([string]$path) {
try {
$stopWatch = [system.diagnostics.stopwatch]::startNew()
if (-not(Test-Path "$path" -pathType container)) { throw "Can't access directory: $path" }
$previousPath = Get-Location
BuildInDir "$path"
if (-not(Test-Path "$path" -pathType container)) { throw "The file path '$path' doesn't exist (yet)" }
$global:results = ""
BuildFolder "$path"
Set-Location "$previousPath"
$repoDirName = (Get-Item "$path").Name
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ Built 📂$repoDirName repository in $elapsed sec."
if ($global:results -eq "") {
"✅ Build of 📂$repoDirName succeeded in $($elapsed)s."
} else {
"✅ Build of 📂$repoDirName succeeded in $($elapsed)s, results in: 📂$($global:results)"
}
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
Set-Location "$previousPath"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value "$PWD"
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -82,4 +83,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -49,15 +49,15 @@ Script Content
try {
$path = Resolve-Path "~/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup"
if (-not(Test-Path "$path" -pathType container)) {
throw "Autostart folder at 📂$path doesn't exist (yet)"
throw "No autostart folder at 📂$path"
}
Set-Location "$path"
"📂$path"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-crashdumps
📂C:\Users\Markus\AppData\Local\CrashDumps
📂C:\Users\Markus\AppData\Local\CrashDumps entered (has 3 files and 0 folders)
```
@ -39,7 +39,7 @@ Script Content
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
PS> ./cd-crashdumps
📂C:\Users\Markus\AppData\Local\CrashDumps
📂C:\Users\Markus\AppData\Local\CrashDumps entered (has 3 files and 0 folders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -50,17 +50,19 @@ try {
if ($IsLinux) { throw "Sorry, Windows only" }
[string]$path = Resolve-Path -Path "~"
if (!(Test-Path "$path" -pathType container)) { throw "Home directory at $path doesn't exist (yet)" }
if (!(Test-Path "$path" -pathType container)) { throw "No home directory at $path" }
$path += "\AppData\Local\CrashDumps"
if (!(Test-Path "$path" -pathType container)) { throw "Crashdumps directory at $path doesn't exist (yet)" }
if (!(Test-Path "$path" -pathType container)) { throw "No crashdumps folder at $path" }
Set-Location "$Path"
"📂$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 in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -47,21 +47,24 @@ Script Content
#>
try {
if ($IsLinux) {
if ($IsLinux -or $IsMacOS) {
if (-not(Test-Path "~/Desktop" -pathType container)) {
throw "No 📂Desktop folder in your home directory yet"
}
$path = Resolve-Path "~/Desktop"
} else {
$path = [Environment]::GetFolderPath('DesktopDirectory')
if (-not(Test-Path "$path" -pathType container)) {
throw "No desktop folder at 📂$path yet"
}
}
if (Test-Path "$path" -pathType container) {
Set-Location "$path"
"📂$path"
exit 0 # success
}
throw "User's desktop folder at 📂$path doesn't exist (yet)"
Set-Location "$path"
"📂$path"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-docs
📂C:\Users\Markus\Documents
📂C:\Users\Markus\Documents entered (has 3 files and 0 folders)
```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the documents folder.
.EXAMPLE
PS> ./cd-docs
📂C:\Users\Markus\Documents
📂C:\Users\Markus\Documents entered (has 3 files and 0 folders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -47,21 +47,26 @@ Script Content
#>
try {
if ($IsLinux) {
if ($IsLinux -or $IsMacOS) {
if (-not(Test-Path "~/Documents" -pathType container)) {
throw "No 📂Documents folder in your home directory yet"
}
$path = Resolve-Path "~/Documents"
} else {
$path = [Environment]::GetFolderPath('MyDocuments')
}
if (-not(Test-Path "$path" -pathType container)) {
throw "Documents folder at 📂$path doesn't exist (yet)"
if (-not(Test-Path "$path" -pathType container)) {
throw "No documents folder at 📂$path yet"
}
}
Set-Location "$path"
"📂$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 in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-downloads
📂C:\Users\Markus\Downloads
📂C:\Users\Markus\Downloads entered (has 0 files and 0 folders)
```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the user's downloads folder.
.EXAMPLE
PS> ./cd-downloads
📂C:\Users\Markus\Downloads
📂C:\Users\Markus\Downloads entered (has 0 files and 0 folders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -47,21 +47,26 @@ Script Content
#>
try {
if ($IsLinux) {
if ($IsLinux -or $IsMacOS) {
if (-not(Test-Path "~/Downloads" -pathType container)) {
throw "No 📂Downloads folder in your home directory yet"
}
$path = Resolve-Path "~/Downloads"
} else {
$path = (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path
if (-not(Test-Path "$path" -pathType container)) {
throw "No downloads folder at 📂$path"
}
}
if (Test-Path "$path" -pathType container) {
Set-Location "$path"
"📂$path"
exit 0 # success
}
throw "User's downloads folder at 📂$path doesn't exist (yet)"
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 in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-dropbox
📂C:\Users\Markus\Dropbox
📂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.
.EXAMPLE
PS> ./cd-dropbox
📂C:\Users\Markus\Dropbox
📂C:\Users\Markus\Dropbox (has 2 files and 4 subfolders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -47,10 +47,14 @@ Script Content
#>
try {
if (-not(Test-Path "~/Dropbox" -pathType container)) {
throw "No 📂Dropbox folder in your home directory - is Dropbox installed?"
}
$path = Resolve-Path "~/Dropbox"
if (-not(Test-Path "$path" -pathType container)) { throw "No Dropbox folder at 📂$path - is Dropbox installed?" }
Set-Location "$path"
"📂$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0])"
@ -58,4 +62,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-etc
📂C:\Windows\System32\drivers\etc
📂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.
.EXAMPLE
PS> ./cd-etc
📂C:\Windows\System32\drivers\etc
📂C:\Windows\System32\drivers\etc (has 2 files and 3 subfolders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -47,21 +47,23 @@ Script Content
#>
try {
if ($IsLinx) {
if ($IsLinux -or $IsMacOS) {
$path = "/etc"
} else {
$path = Resolve-Path "$env:WINDIR\System32\drivers\etc"
}
if (-not(Test-Path "$path" -pathType container)) {
throw "/etc directory at 📂$path doesn't exist (yet)"
throw "No /etc directory at 📂$path"
}
Set-Location "$path"
"📂$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-fonts
📂C:\Windows\Fonts
📂C:\Windows\Fonts (has 2 file and 3 subfolders)
```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the fonts folder.
.EXAMPLE
PS> ./cd-fonts
📂C:\Windows\Fonts
📂C:\Windows\Fonts (has 2 file and 3 subfolders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -49,15 +49,17 @@ Script Content
try {
$path = [Environment]::GetFolderPath('Fonts')
if (-not(Test-Path "$path" -pathType container)) {
throw "Fonts folder at 📂$path doesn't exist (yet)"
throw "No fonts folder at 📂$path"
}
Set-Location "$path"
"📂$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-home.ps1
📂C:\Users\Markus
📂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.
.EXAMPLE
PS> ./cd-home.ps1
📂C:\Users\Markus
📂C:\Users\Markus entered (has 4 files and 7 subfolders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -47,15 +47,17 @@ Script Content
#>
try {
if (-not(Test-Path "~" -pathType container)) { throw "No home directory at $path" }
$path = Resolve-Path "~"
if (-not(Test-Path "$path" -pathType container)) { throw "Home folder at $path doesn't exist (yet)" }
Set-Location "$path"
"📂$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-jenkins
📂C:\Users\Markus\.jenkins
📂C:\Users\Markus\.jenkins entered (has 2 files and 21 folders)
```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the Jenkins home directory.
.EXAMPLE
PS> ./cd-jenkins
📂C:\Users\Markus\.jenkins
📂C:\Users\Markus\.jenkins entered (has 2 files and 21 folders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -55,7 +55,9 @@ try {
throw "No Jenkins home directory found - is Jenkins installed?"
}
Set-Location "$path"
"📂$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])"
@ -63,4 +65,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -24,7 +24,7 @@ Script Content
This PowerShell script changes the current working directory to the logs directory.
.EXAMPLE
PS> ./cd-logs
📂/var/logs
📂/var/logs entered (has 3 files and 2 subfolders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -32,7 +32,7 @@ Script Content
#>
function GetLogsDir {
if ($IsLinux) { return "/var/logs" }
if ($IsLinux -or $IsMacOS) { return "/var/logs" }
$WinDir = [System.Environment]::GetFolderPath('Windows')
return "$WinDir\Logs"
}
@ -40,12 +40,14 @@ function GetLogsDir {
try {
$path = GetLogsDir
Set-Location "$path"
"📂$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-music
📂C:\Users\Markus\Music
📂C:\Users\Markus\Music entered (has 0 files and 3 subfolders)
```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the user's music folder.
.EXAMPLE
PS> ./cd-music
📂C:\Users\Markus\Music
📂C:\Users\Markus\Music entered (has 0 files and 3 subfolders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -52,16 +52,18 @@ try {
} else {
$path = [Environment]::GetFolderPath('MyMusic')
}
if (Test-Path "$path" -pathType container) {
Set-Location "$path"
"📂$path"
exit 0 # success
if (-not(Test-Path "$path" -pathType container)) {
throw "No music folder at 📂$path"
}
throw "User's music folder at 📂$path doesn't exist (yet)"
Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-nextcloud
📂C:\Users\Markus\NextCloud
📂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.
.EXAMPLE
PS> ./cd-nextcloud
📂C:\Users\Markus\NextCloud
📂C:\Users\Markus\NextCloud entered (has 2 files and 3 subfolders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -48,9 +48,13 @@ Script Content
try {
$path = Resolve-Path "~/NextCloud"
if (-not(Test-Path "$path" -pathType container)) { throw "No NextCloud folder at 📂$path - is NextCloud installed?" }
if (-not(Test-Path "$path" -pathType container)) {
throw "No NextCloud folder at $path - is NextCloud installed?"
}
Set-Location "$path"
"📂$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0])"
@ -58,4 +62,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

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

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-pics
📂C:\Users\Markus\Pictures
📂C:\Users\Markus\Pictures entered (has 7 files and 0 subfolders)
```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the user's pictures folder.
.EXAMPLE
PS> ./cd-pics
📂C:\Users\Markus\Pictures
📂C:\Users\Markus\Pictures entered (has 7 files and 0 subfolders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -52,14 +52,18 @@ try {
} else {
$path = [Environment]::GetFolderPath('MyPictures')
}
if (-not(Test-Path "$path" -pathType container)) { throw "Pictures folder at 📂$path doesn't exist (yet)" }
if (-not(Test-Path "$path" -pathType container)) {
throw "No pictures folder at $path"
}
Set-Location "$path"
"📂$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-public
📂C:\Users\Public
📂C:\Users\Public entered (has 2 files and 3 subfolders)
```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the Public folder.
.EXAMPLE
PS> ./cd-public
📂C:\Users\Public
📂C:\Users\Public entered (has 2 files and 3 subfolders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -52,14 +52,18 @@ try {
} else {
$path = Resolve-Path "~/../Public"
}
if (-not(Test-Path "$path" -pathType container)) { throw "Public folder at 📂$path doesn't exist (yet)" }
if (-not(Test-Path "$path" -pathType container)) {
throw "No public folder at $path"
}
Set-Location "$path"
"📂$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-recent
📂C:\Users\Markus\AppData\Roaming\Microsoft\Windows\Recent
📂C:\Users\Markus\AppData\Roaming\Microsoft\Windows\Recent entered (has 2 files and 3 subfolders)
```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the 'recent' folder.
.EXAMPLE
PS> ./cd-recent
📂C:\Users\Markus\AppData\Roaming\Microsoft\Windows\Recent
📂C:\Users\Markus\AppData\Roaming\Microsoft\Windows\Recent entered (has 2 files and 3 subfolders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -49,10 +49,12 @@ Script Content
try {
$path = [Environment]::GetFolderPath('Recent')
if (-not(Test-Path "$path" -pathType container)) {
throw "Recent folder at 📂$path doesn't exist (yet)"
throw "No recent folder at $path"
}
Set-Location "$path"
"📂$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -60,4 +62,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -24,7 +24,7 @@ Script Content
This PowerShell script changes the working directory to the user's recycle bin folder.
.EXAMPLE
PS> ./cd-recycle-bin
📂C:\$Recycle.Bin\S-1-5-21-123404-23309-294260-1001
📂C:\$Recycle.Bin\S-1-5-21-123404-23309-294260-1001 entered (has 2 files and 0 subfolders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -43,14 +43,18 @@ try {
} else {
$path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)"
}
if (-not(Test-Path "$path" -pathType container)) { throw "Recycle bin folder at 📂$path doesn't exist (yet)" }
if (-not(Test-Path "$path" -pathType container)) {
throw "No recycle bin folder at $path"
}
Set-Location "$path"
"📂$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -26,7 +27,7 @@ Example
-------
```powershell
PS> ./cd-repo.ps1 rust
📂C:\Repos\rust · on branch: ## main ... origin/main
📂C:\Repos\rust entered, current branch is: ## main ... origin/main
```
@ -50,7 +51,7 @@ Script Content
Specifies the folder name of the Git repository
.EXAMPLE
PS> ./cd-repo.ps1 rust
📂C:\Repos\rust · on branch: ## main ... origin/main
📂C:\Repos\rust entered, current branch is: ## main ... origin/main
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -60,36 +61,28 @@ Script Content
param([string]$folderName = "")
try {
if ("$folderName" -eq "") { $folderName = Read-Host "Enter the Git repository's folder name" }
if ("$folderName" -eq "") { $folderName = Read-Host "Please enter the Git repository's folder name" }
if (Test-Path "~/Repos" -pathType Container) { # try short name in home dir
$path = "~/Repos"
} elseif (Test-Path "~/repos" -pathType Container) {
$path = "~/repos"
} elseif (Test-Path "~/Repositories" -pathType Container) { # try long name
$path = "~/Repositories"
} elseif (Test-Path "~/repositories" -pathType Container) {
$path = "~/repositories"
} elseif (Test-Path "/Repos" -pathType Container) { # try short name in root dir
$path = "/Repos"
} elseif (Test-Path "/repos" -pathType Container) {
$path = "/repos"
} elseif (Test-Path "/Repositories" -pathType Container) { # try long name
$path = "/Repositories"
} elseif (Test-Path "/repositories" -pathType Container) {
$path = "/repositories"
} elseif (Test-Path "~/source/repos" -pathType Container) { # try Visual Studio default
$path = "~/source/repos"
if (Test-Path "~/Repos" -pathType container) { $path = "~/Repos"
} elseif (Test-Path "~/repos" -pathType container) { $path = "~/repos"
} elseif (Test-Path "~/Repositories" -pathType container) { $path = "~/Repositories"
} elseif (Test-Path "~/repositories" -pathType container) { $path = "~/repositories"
} elseif (Test-Path "/Repos" -pathType container) { $path = "/Repos"
} elseif (Test-Path "/repos" -pathType container) { $path = "/repos"
} 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 "D:/Repos" -pathType container) { $path = "D:/Repos" # second HDD
} else {
throw "No Git repositories folder in your home directory or in the root folder yet"
}
$path += "/" + $folderName
if (-not(Test-Path "$path" -pathType container)) { throw "The path to 📂$path doesn't exist (yet)" }
if (-not(Test-Path "$path" -pathType container)) { throw "The file path '$path' doesn't exist (yet)" }
$path = Resolve-Path "$path"
Set-Location "$path"
Write-Host "📂$path · on branch: " -noNewline
& git status --short --branch --show-stash
Write-Host "📂$path entered, current branch is: " -noNewline
& git status --branch --short
exit 0 # success
} catch {
"⚠️ Error: $($Error[0])"
@ -97,4 +90,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -1,7 +1,7 @@
The *cd-repos.ps1* Script
===========================
This PowerShell script changes the working directory to the Git repositories folder.
This PowerShell script changes the working directory to the folder for Git repositories.
Parameters
----------
@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-repos.ps1
📂C:\Repos
📂C:\Repos (has 33 subfolders)
```
@ -34,14 +34,12 @@ Script Content
```powershell
<#
.SYNOPSIS
Sets the working directory to the Git repos folder
Sets the working dir to the repos folder
.DESCRIPTION
This PowerShell script changes the working directory to the Git repositories folder.
.PARAMETER subpath
Specifies an additional relative subpath (optional)
This PowerShell script changes the working directory to the folder for Git repositories.
.EXAMPLE
PS> ./cd-repos.ps1
📂C:\Repos
📂C:\Repos (has 33 subfolders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -49,30 +47,23 @@ Script Content
#>
try {
if (Test-Path "~/Repos" -pathType Container) { # try short name in home dir
$path = "~/Repos"
} elseif (Test-Path "~/repos" -pathType Container) {
$path = "~/repos"
} elseif (Test-Path "~/Repositories" -pathType Container) { # try long name
$path = "~/Repositories"
} elseif (Test-Path "~/repositories" -pathType Container) {
$path = "~/repositories"
} elseif (Test-Path "/Repos" -pathType Container) { # try short name in root dir
$path = "/Repos"
} elseif (Test-Path "/repos" -pathType Container) {
$path = "/repos"
} elseif (Test-Path "/Repositories" -pathType Container) { # try long name
$path = "/Repositories"
} elseif (Test-Path "/repositories" -pathType Container) {
$path = "/repositories"
} elseif (Test-Path "~/source/repos" -pathType Container) { # try Visual Studio default
$path = "~/source/repos"
if (Test-Path "~/Repos" -pathType container) { $path = "~/Repos"
} elseif (Test-Path "~/repos" -pathType container) { $path = "~/repos"
} elseif (Test-Path "~/Repositories" -pathType container) { $path = "~/Repositories"
} elseif (Test-Path "~/repositories" -pathType container) { $path = "~/repositories"
} elseif (Test-Path "/Repos" -pathType container) { $path = "/Repos"
} elseif (Test-Path "/repos" -pathType container) { $path = "/repos"
} 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 "D:/Repos" -pathType container) { $path = "D:/Repos" # second HDD
} else {
throw "No Git repositories folder in your home directory or in the root folder yet"
throw "No folder found for Git repositories (in home or root directory) - Please create one."
}
$path = Resolve-Path $path
Set-Location "$path"
"📂$path"
$subfolders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($subfolders.Count) subfolders)"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0])"
@ -80,4 +71,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-root
📂C:\
📂C:\ entered (has 0 files and 7 folders)
```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the current working directory to the root directory (C:\ on Windows).
.EXAMPLE
PS> ./cd-root
📂C:\
📂C:\ entered (has 0 files and 7 folders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -49,12 +49,14 @@ Script Content
try {
if ($IsLinux) { $path = "/" } else { $path = "C:\" }
Set-Location "$path"
"📂$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 in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -24,7 +24,7 @@ Script Content
This PowerShell script changes the working directory to the user's screenshots folder.
.EXAMPLE
PS> ./cd-screenshots
📂C:\Users\Markus\Pictures\Screenshots
📂C:\Users\Markus\Pictures\Screenshots (has 7 files and 0 folders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -47,12 +47,14 @@ function GetScreenshotsFolder {
try {
$path = GetScreenshotsFolder
Set-Location "$path"
"📂$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 in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-scripts.ps1
📂C:\Repos\PowerShell\scripts
📂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.
.EXAMPLE
PS> ./cd-scripts.ps1
📂C:\Repos\PowerShell\scripts
📂C:\Repos\PowerShell\scripts entered (has 645 scripts)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -48,14 +48,17 @@ Script Content
try {
$path = Resolve-Path "$PSScriptRoot"
if (-not(Test-Path "$path" -pathType container)) { throw "PowerShell scripts folder at 📂$path doesn't exist (yet)" }
if (-not(Test-Path "$path" -pathType container)) {
throw "No PowerShell scripts folder at 📂$path"
}
Set-Location "$path"
"📂$path"
$files = Get-ChildItem $path -attributes !Directory
"📂$path entered (has $($files.Count) scripts)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-ssh.ps1
📂C:\Users\Markus\.ssh
📂C:\Users\Markus\.ssh entered (has 4 files)
```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the user's secure shell (SSH) folder.
.EXAMPLE
PS> ./cd-ssh.ps1
📂C:\Users\Markus\.ssh
📂C:\Users\Markus\.ssh entered (has 4 files)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -48,10 +48,13 @@ Script Content
try {
$path = "~/.ssh"
if (-not(Test-Path "$path" -pathType container)) { throw "Your secure shell (SSH) folder at 📂$path doesn't exist (yet)" }
if (-not(Test-Path "$path" -pathType container)) {
throw "No secure shell (SSH) folder at $path"
}
$path = Resolve-Path "$path"
Set-Location "$path"
"📂$Path"
$files = Get-ChildItem $path -attributes !Directory
"📂$path entered (has $($files.Count) files)"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0])"
@ -59,4 +62,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -24,7 +24,7 @@ Script Content
This PowerShell script changes the working directory to the temporary folder.
.EXAMPLE
PS> ./cd-temp
📂C:\Users\Markus\AppData\Local\Temp
📂C:\Users\Markus\AppData\Local\Temp (has 2 files and 3 subfolders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -40,14 +40,18 @@ function GetTempDir {
try {
$path = GetTempDir
if (-not(Test-Path "$path" -pathType container)) { throw "Temporary folder at 📂$path doesn't exist (yet)" }
if (-not(Test-Path "$path" -pathType container)) { throw
"No temporary folder at $path"
}
Set-Location "$path"
"📂$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-templates
📂/home/Markus/Templates
📂/home/Markus/Templates entered (has 3 files and 0 subfolders)
```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the templates folder.
.EXAMPLE
PS> ./cd-templates
📂/home/Markus/Templates
📂/home/Markus/Templates entered (has 3 files and 0 subfolders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -52,14 +52,18 @@ try {
} else {
$path = [Environment]::GetFolderPath('Templates')
}
if (-not(Test-Path "$path" -pathType container)) { throw "Templates folder at 📂$path doesn't exist (yet)" }
if (-not(Test-Path "$path" -pathType container)) {
throw "No templates folder at $path"
}
Set-Location "$path"
"📂$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -24,7 +24,7 @@ Script Content
This PowerShell script changes the working directory to the user's trash folder.
.EXAMPLE
PS> ./cd-trash
📂C:\$Recycle.Bin\S-1-5-21-123404-23309-294260-1001
📂C:\$Recycle.Bin\S-1-5-21-123404-23309-294260-1001 entered (has 4 files and 0 subfolders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -43,14 +43,18 @@ try {
} else {
$path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)"
}
if (-not(Test-Path "$path" -pathType container)) { throw "Trash folder at 📂$path doesn't exist (yet)" }
if (-not(Test-Path "$path" -pathType container)) {
throw "No trash folder at $path"
}
Set-Location "$path"
"📂$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-users
📂C:\Users
📂C:\Users entered (has 0 files and 4 subfolders)
```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the users directory.
.EXAMPLE
PS> ./cd-users
📂C:\Users
📂C:\Users entered (has 0 files and 4 subfolders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -48,14 +48,18 @@ Script Content
try {
$path = Resolve-Path "~/.."
if (-not(Test-Path "$path" -pathType container)) { throw "Users directory at 📂$path doesn't exist (yet)" }
if (-not(Test-Path "$path" -pathType container)) {
throw "No users directory at $path"
}
Set-Location "$path"
"📂$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-videos
📂C:\Users\Markus\Videos
📂C:\Users\Markus\Videos entered (has 3 files and 0 subfolders)
```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the user's videos folder.
.EXAMPLE
PS> ./cd-videos
📂C:\Users\Markus\Videos
📂C:\Users\Markus\Videos entered (has 3 files and 0 subfolders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -52,14 +52,18 @@ try {
} else {
$path = [Environment]::GetFolderPath('MyVideos')
}
if (-not(Test-Path "$path" -pathType container)) { throw "Videos folder at 📂$path doesn't exist (yet)" }
if (-not(Test-Path "$path" -pathType container)) {
throw "No videos folder at $path"
}
Set-Location "$path"
"📂$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./cd-windows
📂C:\Windows
📂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.
.EXAMPLE
PS> ./cd-windows
📂C:\Windows
📂C:\Windows entered (has 7 files and 42 subfolders)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -48,14 +48,18 @@ Script Content
try {
$path = Resolve-Path "$env:WINDIR"
if (-not(Test-Path "$path" -pathType container)) { throw "Windows directory at 📂$path doesn't exist" }
if (-not(Test-Path "$path" -pathType container)) {
throw "No Windows directory at $path"
}
Set-Location "$path"
"📂$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -69,7 +70,7 @@ try {
$Path = "$(GetTempDir)/next_wallpaper.jpg"
& wget -O $Path "https://source.unsplash.com/3840x2160?$Category"
if ($lastExitCode -ne "0") { throw "Download failed" }
if ($lastExitCode -ne 0) { throw "Download failed" }
& "$PSScriptRoot/set-wallpaper.ps1" -ImageFile "$Path"
exit 0 # success
@ -79,4 +80,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value "$HOME\my.credentials"
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -82,4 +83,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
-minLevel <Int64>
@ -24,6 +25,7 @@ Parameters
Position? 2
Default value 10000000
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -110,4 +112,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value 5368709120
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -102,4 +103,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -75,4 +76,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -170,4 +171,4 @@ function Check-Header { param( $path )
Check-Header $Path
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -28,7 +28,7 @@ Script Content
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
Author: Markus Fleschutz, Tyler MacInnis | License: CC0
#>
function Bytes2String { param([int64]$Bytes)
@ -48,15 +48,17 @@ try {
# TODO
} else {
$Details = Get-WmiObject Win32_VideoController
$Model = $Details.Caption
$RAMSize = $Details.AdapterRAM
$ResWidth = $Details.CurrentHorizontalResolution
$ResHeight = $Details.CurrentVerticalResolution
$BitsPerPixel = $Details.CurrentBitsPerPixel
$RefreshRate = $Details.CurrentRefreshRate
$DriverVersion = $Details.DriverVersion
$Status = $Details.Status
Write-Host "✅ $Model GPU ($(Bytes2String $RAMSize) RAM, $($ResWidth)x$($ResHeight) pixels, $($BitsPerPixel)-bit, $($RefreshRate)Hz, driver $DriverVersion) - status $Status"
foreach ($GPU in $Details) {
$Model = $GPU.Caption
$RAMSize = $GPU.AdapterRAM
$ResWidth = $GPU.CurrentHorizontalResolution
$ResHeight = $GPU.CurrentVerticalResolution
$BitsPerPixel = $GPU.CurrentBitsPerPixel
$RefreshRate = $GPU.CurrentRefreshRate
$DriverVersion = $GPU.DriverVersion
$Status = $GPU.Status
Write-Host "✅ $Model GPU ($(Bytes2String $RAMSize) RAM, $($ResWidth)x$($ResHeight) pixels, $($BitsPerPixel)-bit, $($RefreshRate)Hz, driver $DriverVersion) - status $Status"
}
}
exit 0 # success
} catch {
@ -65,4 +67,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(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
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(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
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -84,4 +85,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -98,4 +99,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -16,6 +16,7 @@ Parameters
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -87,4 +88,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(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
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(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 01/23/2025 12:15:19)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -14,6 +14,7 @@ Parameters
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -94,4 +95,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -24,7 +24,7 @@ Script Content
This PowerShell script queries pending operating system reboots and prints it.
.EXAMPLE
./check-pending-reboot.ps1
✅ No pending reboot
✅ No pending reboot.
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -41,7 +41,7 @@ function Test-RegistryValue { param([parameter(Mandatory=$true)][ValidateNotNull
}
try {
$reply = "✅ No pending reboot"
[string]$reply = "✅ No pending reboot."
if ($IsLinux) {
if (Test-Path "/var/run/reboot-required") {
$reply = "⚠️ Pending reboot (found: /var/run/reboot-required)"
@ -79,7 +79,7 @@ try {
$reason += ", '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'"
}
if ($reason -ne "") {
$reply = "⚠️ Pending reboot (registry got $($reason.substring(2)))"
$reply = "⚠️ Pending reboot (found: $($reason.substring(2)) in registry)"
}
}
Write-Host $reply
@ -90,4 +90,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(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 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -60,10 +60,10 @@ try {
if ($details.PowerLineStatus -eq "Online") {
if ($details.BatteryChargeStatus -eq "NoSystemBattery") {
$reply = "✅ AC powered"
} elseif ($percent -ge 95) {
$reply = "✅ Battery full ($percent%, power scheme is '$powerScheme')"
} elseif ($percent -ge 90) {
$reply = "✅ Battery $percent% full (power scheme is '$powerScheme')"
} else {
$reply = "✅ Battery charging ($percent%, power scheme is '$powerScheme')"
$reply = "✅ Battery $percent% and charging (power scheme is '$powerScheme')"
}
} else { # must be offline
if (($remaining -eq 0) -and ($percent -ge 60)) {
@ -77,7 +77,7 @@ try {
} elseif ($percent -lt 10) {
$reply = "⚠️ Battery $percent% only with $($remaining)min remaining (power scheme is '$powerScheme') "
} elseif ($percent -ge 90) {
$reply = "✅ Battery full ($percent%, $($remaining)min remaining, power scheme is '$powerScheme')"
$reply = "✅ Battery $percent% full ($($remaining)min remaining, power scheme is '$powerScheme')"
} else {
$reply = "✅ Battery $percent% with $($remaining)min remaining (power scheme is '$powerScheme') "
}
@ -91,4 +91,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(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 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -76,4 +77,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(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 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value "$PWD"
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -78,7 +79,7 @@ try {
Write-Host "⏳ (1/10) Searching for Git executable... " -noNewline
& 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" }
Write-Host "⏳ (2/10) Checking local repository... " -noNewline
$FullPath = Resolve-Path "$pathToRepo"
@ -87,15 +88,15 @@ try {
Write-Host "⏳ (3/10) Querying remote URL... " -noNewline
& git -C "$FullPath" remote get-url origin
if ($lastExitCode -ne "0") { throw "'git remote get-url origin' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git remote get-url origin' failed with exit code $lastExitCode" }
Write-Host "⏳ (4/10) Querying current branch... " -noNewline
& git -C "$FullPath" branch --show-current
if ($lastExitCode -ne "0") { throw "'git branch --show-current' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git branch --show-current' failed with exit code $lastExitCode" }
Write-Host "⏳ (5/10) Fetching remote updates... " -noNewline
& git -C "$FullPath" fetch --all --recurse-submodules --tags --force --quiet
if ($lastExitCode -ne "0") { throw "'git fetch' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git fetch' failed with exit code $lastExitCode" }
Write-Host "OK"
Write-Host "⏳ (6/10) Querying latest tag... " -noNewline
@ -105,19 +106,19 @@ try {
Write-Host "⏳ (7/10) Verifying data integrity..."
& git -C "$FullPath" fsck
if ($lastExitCode -ne "0") { throw "'git fsck' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git fsck' failed with exit code $lastExitCode" }
Write-Host "⏳ (8/10) Running maintenance tasks..."
& git -C "$FullPath" maintenance run
if ($lastExitCode -ne "0") { throw "'git maintenance run' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git maintenance run' failed with exit code $lastExitCode" }
Write-Host "⏳ (9/10) Checking submodule status..."
& git -C "$FullPath" submodule status
if ($lastExitCode -ne "0") { throw "'git submodule status' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git submodule status' failed with exit code $lastExitCode" }
Write-Host "⏳ (10/10) Checking repo status... " -noNewline
& git -C "$FullPath" status
if ($lastExitCode -ne "0") { throw "'git status --short' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git status --short' failed with exit code $lastExitCode" }
$repoDirName = (Get-Item "$FullPath").Name
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
@ -129,4 +130,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value "$PWD"
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -91,4 +92,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(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 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -49,7 +49,7 @@ function Bytes2String([int64]$bytes) {
try {
$result = (smartctl --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'smartctl' - make sure smartmontools are installed" }
if ($lastExitCode -ne 0) { throw "Can't execute 'smartctl' - make sure smartmontools are installed" }
if ($IsLinux) {
$devices = $(sudo smartctl --scan-open)
@ -120,4 +120,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(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
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -84,4 +85,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value 10
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -89,16 +90,16 @@ try {
[int64]$free = ($total - $used)
}
if ($total -eq 0) {
Write-Output "⚠️ No swap space configured"
Write-Output "⚠️ No swap space configured."
} elseif ($free -eq 0) {
Write-Output "⚠️ Swap space with $(MB2String $total) is FULL !!!"
Write-Output "⚠️ Swap space of $(MB2String $total) is FULL!"
} elseif ($free -lt $minLevel) {
Write-Output "⚠️ Swap space has only $(MB2String $free) of $(MB2String $total) left!"
} elseif ($used -lt 3) {
Write-Output "✅ Swap space has $(MB2String $total) reserved"
Write-Output "✅ Swap space has $(MB2String $total) reserved."
} else {
[int64]$percent = ($used * 100) / $total
Write-Output "✅ Swap space uses $(MB2String $used) ($percent%) of $(MB2String $total)"
Write-Output "✅ Swap space at $(MB2String $used) ($percent%) of $(MB2String $total)."
}
exit 0 # success
} catch {
@ -107,4 +108,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -1,8 +1,7 @@
The *check-symlinks.ps1* Script
===========================
This PowerShell script checks every symbolic link in a folder (including subfolders).
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.
Parameters
----------
@ -16,6 +15,7 @@ Parameters
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -26,9 +26,9 @@ Parameters
Example
-------
```powershell
PS> ./check-symlinks C:\Users
Checking symlinks at 📂C:\Users including subfolders...
✅ Found 0 broken symlinks at 📂C:\Users in 60 sec
PS> ./check-symlinks D:\
Please wait while checking symlinks at: 📂D:\ ...
✅ Found 0 broken symlinks at 📂D:\ in 60s.
```
@ -45,16 +45,15 @@ Script Content
```powershell
<#
.SYNOPSIS
Checks symlinks in a folder
Checks all symlinks in a folder
.DESCRIPTION
This PowerShell script checks every symbolic link in a folder (including subfolders).
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
Specifies the path to the folder
.EXAMPLE
PS> ./check-symlinks C:\Users
Checking symlinks at 📂C:\Users including subfolders...
✅ Found 0 broken symlinks at 📂C:\Users in 60 sec
PS> ./check-symlinks D:\
Please wait while checking symlinks at: 📂D:\ ...
✅ Found 0 broken symlinks at 📂D:\ in 60s.
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -64,40 +63,40 @@ Script Content
param([string]$Folder = "")
try {
if ($Folder -eq "" ) { $Folder = read-host "Enter the path to the folder" }
if ($Folder -eq "" ) { $Folder = Read-Host "Enter the path to the folder" }
$StopWatch = [system.diagnostics.stopwatch]::startNew()
$FullPath = Resolve-Path "$Folder"
"⏳ Checking symlinks at 📂$FullPath including subfolders..."
$stopWatch = [system.diagnostics.stopwatch]::startNew()
$fullPath = Resolve-Path "$Folder"
"⏳ Please wait while checking symlinks at 📂$fullPath ..."
[int]$NumTotal = [int]$NumBroken = 0
Get-ChildItem $FullPath -recurse | Where { $_.Attributes -match "ReparsePoint" } | ForEach-Object {
[int]$numTotal = [int]$numBroken = 0
Get-ChildItem $fullPath -recurse | Where { $_.Attributes -match "ReparsePoint" } | ForEach-Object {
$Symlink = $_.FullName
$Target = ($_ | Select-Object -ExpandProperty Target -ErrorAction Ignore)
if ($Target) {
$path = $_.FullName + "\..\" + ($_ | Select-Object -ExpandProperty Target)
$item = Get-Item $path -ErrorAction Ignore
if (!$item) {
$NumBroken++
"Symlink $Symlink to: $Target seems broken (#$NumBroken)"
$numBroken++
"Broken symlink #$($numBroken) at $Symlink linking to: $Target"
}
}
$NumTotal++
$numTotal++
}
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
if ($NumTotal -eq 0) {
"✅ No symlink found at 📂$FullPath in $Elapsed sec"
} elseif ($NumBroken -eq 1) {
"✅ Found $NumBroken broken symlink at 📂$FullPath in $Elapsed sec"
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
if ($numTotal -eq 0) {
"✅ No symlink found at 📂$fullPath in $($elapsed)s."
} elseif ($numBroken -eq 1) {
"✅ Found $numBroken broken symlink at 📂$fullPath in $($elapsed)s ($numTotal symlinks in total)."
} else {
"✅ Found $NumBroken broken symlinks at 📂$FullPath in $Elapsed sec"
"✅ Found $numBroken broken symlinks at 📂$fullPath in $($elapsed)s ($numTotal symlinks in total)."
}
exit $NumBroken
exit $numBroken
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(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 01/23/2025 12:15:20)*
*(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 01/23/2025 12:15:20)*
*(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 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -81,4 +82,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(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 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -72,4 +73,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -50,7 +50,7 @@ Script Content
try {
sfc /verifyOnly
if ($lastExitCode -ne "0") { throw "'sfc /verifyOnly' failed" }
if ($lastExitCode -ne 0) { throw "'sfc /verifyOnly' failed" }
"✅ checked Windows system files"
exit 0 # success
@ -60,4 +60,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -26,7 +27,7 @@ Example
-------
```powershell
PS> ./check-xml-file.ps1 myfile.xml
Valid XML in 📄myfile.xml
✅ myfile.xml is valid XML
```
@ -50,7 +51,7 @@ Script Content
Specifies the path to the XML file
.EXAMPLE
PS> ./check-xml-file.ps1 myfile.xml
Valid XML in 📄myfile.xml
✅ myfile.xml is valid XML
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -77,7 +78,7 @@ try {
if ($script:ErrorCount -gt 0) { throw "Invalid XML" }
"✅ Valid XML in 📄$path"
"✅ $path is valid XML"
exit 0 # success
} catch {
"⚠️ $($Error[0]) in 📄$path"
@ -85,4 +86,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value "$PWD"
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -83,4 +84,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -16,6 +16,7 @@ Parameters
Position? 1
Default value "$PWD"
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -27,11 +28,11 @@ Example
-------
```powershell
PS> ./clean-repo.ps1 C:\Repos\rust
⏳ (1/4) Searching for Git executable... git version 2.45.0
⏳ (1/4) Searching for Git executable... git version 2.47.0
⏳ (2/4) Checking local repository... C:\Repos\rust
⏳ (3/4) Removing untracked files in repository...
⏳ (4/4) Removing untracked files in submodules...
Cleaned up repo 📂rust in 2s.
Repo 📂rust is clean now.
```
@ -56,11 +57,11 @@ Script Content
Specifies the file path to the local Git repository (current working directory by default)
.EXAMPLE
PS> ./clean-repo.ps1 C:\Repos\rust
⏳ (1/4) Searching for Git executable... git version 2.45.0
⏳ (1/4) Searching for Git executable... git version 2.47.0
⏳ (2/4) Checking local repository... C:\Repos\rust
⏳ (3/4) Removing untracked files in repository...
⏳ (4/4) Removing untracked files in submodules...
Cleaned up repo 📂rust in 2s.
Repo 📂rust is clean now.
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -70,11 +71,9 @@ Script Content
param([string]$path = "$PWD")
try {
$stopWatch = [system.diagnostics.stopwatch]::startNew()
Write-Host "⏳ (1/4) Searching for Git executable... " -noNewline
& 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" }
"⏳ (2/4) Checking local repository... $path"
if (-not(Test-Path "$path" -pathType container)) { throw "Can't access repo folder '$path' - maybe a typo or missing folder permissions?" }
@ -82,18 +81,17 @@ try {
"⏳ (3/4) Removing untracked files in repository..."
& git -C "$path" clean -xfd -f # to delete all untracked files in the main repo
if ($lastExitCode -ne "0") {
if ($lastExitCode -ne 0) {
Write-Warning "'git clean' failed with exit code $lastExitCode, retrying once..."
& git -C "$path" clean -xfd -f
if ($lastExitCode -ne "0") { throw "'git clean' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git clean' failed with exit code $lastExitCode" }
}
"⏳ (4/4) Removing untracked files in 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" }
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ Cleaned up repo 📂$repoName in $($elapsed)s."
"✅ Repo 📂$repoName is clean now."
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -101,4 +99,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value "$PWD"
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -26,7 +27,7 @@ Example
-------
```powershell
PS> ./clean-repos.ps1 C:\MyRepos
⏳ (1) Searching for Git executable... git version 2.40.1
⏳ (1) Searching for Git executable... git version 2.47.1
⏳ (2) Checking parent folder 📂Repos... 28 subfolders found
⏳ (3/30) Cleaning 📂base256unicode...
...
@ -53,7 +54,7 @@ Script Content
Specifies the path to the parent folder (current working dir by default)
.EXAMPLE
PS> ./clean-repos.ps1 C:\MyRepos
⏳ (1) Searching for Git executable... git version 2.40.1
⏳ (1) Searching for Git executable... git version 2.47.1
⏳ (2) Checking parent folder 📂Repos... 28 subfolders found
⏳ (3/30) Cleaning 📂base256unicode...
...
@ -70,7 +71,7 @@ try {
Write-Host "⏳ (1) Searching for Git executable... " -noNewline
& 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" }
$parentDirName = (Get-Item "$ParentDir").Name
Write-Host "⏳ (2) Checking parent folder 📂$parentDirName... " -noNewline
@ -86,13 +87,13 @@ try {
"⏳ ($Step/$($numFolders + 2)) Cleaning 📂$FolderName..."
& git -C "$folder" clean -xfd -f # force + recurse into dirs + don't use the standard ignore rules
if ($lastExitCode -ne "0") { throw "'git clean -xfd -f' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git clean -xfd -f' failed with exit code $lastExitCode" }
& git -C "$folder" submodule foreach --recursive git clean -xfd -f
if ($lastExitCode -ne "0") { throw "'git clean -xfd -f' in submodules failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git clean -xfd -f' in submodules failed with exit code $lastExitCode" }
}
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ Cleaned $numFolders Git repos under 📂$parentDirName in $elapsed sec"
"✅ Cleaned $numFolders Git repositories under 📂$parentDirName in $($elapsed)s."
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -100,4 +101,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(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 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -48,7 +48,7 @@ Script Content
try {
Clear-RecycleBin -Confirm:$false
if ($lastExitCode -ne "0") { throw "'Clear-RecycleBin' failed" }
if ($lastExitCode -ne 0) { throw "'Clear-RecycleBin' failed" }
& "$PSScriptRoot/speak-english.ps1" "It's clean now."
exit 0 # success
@ -58,4 +58,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value "$PWD"
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -29,7 +30,7 @@ PS> ./clone-repos C:\MyRepos
⏳ (1) Searching for Git executable... git version 2.46.0.windows.1
⏳ (2) Reading data/popular-repos.csv... 29 repos
⏳ (3) Checking target folder... 📂Repos
⏳ (4/32) Cloning 📂base256 (dev tool) from git@github.com:fleschutz/talk2windows.git (shallow main branch)...
⏳ (4/32) Cloning 📂base256 (dev tool) from git@github.com:fleschutz/talk2windows.git (main branch only)...
...
```
@ -57,7 +58,7 @@ Script Content
⏳ (1) Searching for Git executable... git version 2.46.0.windows.1
⏳ (2) Reading data/popular-repos.csv... 29 repos
⏳ (3) Checking target folder... 📂Repos
⏳ (4/32) Cloning 📂base256 (dev tool) from git@github.com:fleschutz/talk2windows.git (shallow main branch)...
⏳ (4/32) Cloning 📂base256 (dev tool) from git@github.com:fleschutz/talk2windows.git (main branch only)...
...
.LINK
https://github.com/fleschutz/PowerShell
@ -72,7 +73,7 @@ try {
Write-Host "⏳ (1) Searching for Git executable... " -noNewline
& 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" }
Write-Host "⏳ (2) Reading data/popular-repos.csv... " -noNewline
$table = Import-CSV "$PSScriptRoot/../data/popular-repos.csv"
@ -98,14 +99,14 @@ try {
"⏳ ($step/$($total + 3)) Skipping 📂$folderName ($category): exists already"
$skipped++
} elseif ($shallow -eq "yes") {
"⏳ ($step/$($total + 3)) Cloning 📂$folderName ($category) from $URL (shallow $branch branch)..."
"⏳ ($step/$($total + 3)) Cloning 📂$folderName ($category) from $URL ($branch branch only)..."
& git clone --branch "$branch" --single-branch --recurse-submodules "$URL" "$targetDir/$folderName"
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
$cloned++
} else {
"⏳ ($step/$($total + 3)) Cloning 📂$folderName ($category) from $URL (full $branch branch)..."
& git clone --branch "$branch" --recurse-submodules "$URL" "$targetDir/$folderName"
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
$clone++
}
}
@ -118,4 +119,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -15,6 +15,7 @@ Parameters
Position? 1
Default value "$PWD"
Accept pipeline input? false
Aliases
Accept wildcard characters? false
[<CommonParameters>]
@ -74,4 +75,4 @@ try {
}
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*

View File

@ -48,4 +48,4 @@ Stop-Process -name "CalculatorApp"
exit 0 # success
```
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
*(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