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

@@ -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)*