mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-22 21:11:32 +02:00
Updated the manuals
This commit is contained in:
parent
df7368ff91
commit
d8690419ea
@ -116,4 +116,4 @@ try {
|
||||
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:33)*
|
||||
|
@ -72,4 +72,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:33)*
|
||||
|
@ -1,7 +1,8 @@
|
||||
The *build-repo.ps1* Script
|
||||
===========================
|
||||
|
||||
This PowerShell script builds a Git repository by supporting the build systems: autogen, cmake, configure, Gradle, Imakefile, Makefile, and Meson.
|
||||
This PowerShell script builds a Git repository by supporting the following build
|
||||
systems: autogen, cargo, cmake, configure, Gradle, Imakefile, Makefile, and Meson.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@ -9,7 +10,7 @@ Parameters
|
||||
/Repos/PowerShell/scripts/build-repo.ps1 [[-path] <String>] [<CommonParameters>]
|
||||
|
||||
-path <String>
|
||||
Specifies the path to the Git repository (current working directory by default)
|
||||
Specifies the file path to the Git repository (default: current working directory)
|
||||
|
||||
Required? false
|
||||
Position? 1
|
||||
@ -29,7 +30,7 @@ Example
|
||||
PS> ./build-repo.ps1 C:\Repos\ninja
|
||||
⏳ Building 📂ninja by using CMake...
|
||||
...
|
||||
✅ Build of 📂ninja succeeded in 47s, results in: 📂C:\Repos\ninja\_results
|
||||
✅ Build of 📂ninja succeeded in 47s, results at: 📂C:\Repos\ninja\_results
|
||||
|
||||
```
|
||||
|
||||
@ -48,14 +49,15 @@ Script Content
|
||||
.SYNOPSIS
|
||||
Builds a repo
|
||||
.DESCRIPTION
|
||||
This PowerShell script builds a Git repository by supporting the build systems: autogen, cmake, configure, Gradle, Imakefile, Makefile, and Meson.
|
||||
This PowerShell script builds a Git repository by supporting the following build
|
||||
systems: autogen, cargo, cmake, configure, Gradle, Imakefile, Makefile, and Meson.
|
||||
.PARAMETER path
|
||||
Specifies the path to the Git repository (current working directory by default)
|
||||
Specifies the file path to the Git repository (default: current working directory)
|
||||
.EXAMPLE
|
||||
PS> ./build-repo.ps1 C:\Repos\ninja
|
||||
⏳ Building 📂ninja by using CMake...
|
||||
...
|
||||
✅ Build of 📂ninja succeeded in 47s, results in: 📂C:\Repos\ninja\_results
|
||||
✅ Build of 📂ninja succeeded in 47s, results at: 📂C:\Repos\ninja\_results
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -85,6 +87,13 @@ function BuildFolder([string]$path) {
|
||||
"⏳ (4/4) Executing 'ctest -V'... (if tests are provided)"
|
||||
& ctest -V
|
||||
if ($lastExitCode -ne 0) { throw "Executing 'ctest -V' failed with exit code $lastExitCode" }
|
||||
} elseif (Test-Path "$path/.cargo/release.toml" -pathType leaf) {
|
||||
"⏳ (1/4) Building 📂$dirName by using Cargo..."
|
||||
Set-Location "$path/"
|
||||
|
||||
& cargo build --config .cargo/release.toml --release
|
||||
if ($lastExitCode -ne 0) { throw "Executing 'cargo build' failed with exit code $lastExitCode" }
|
||||
|
||||
} elseif (Test-Path "$path/autogen.sh" -pathType leaf) {
|
||||
"⏳ Building 📂$dirName by executing 'autogen.sh'..."
|
||||
Set-Location "$path/"
|
||||
@ -193,7 +202,7 @@ try {
|
||||
if ($global:results -eq "") {
|
||||
"✅ Build of 📂$repoDirName succeeded in $($elapsed)s."
|
||||
} else {
|
||||
"✅ Build of 📂$repoDirName succeeded in $($elapsed)s, results in: 📂$($global:results)"
|
||||
"✅ Build of 📂$repoDirName succeeded in $($elapsed)s, results at: 📂$($global:results)"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
@ -203,4 +212,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -83,4 +83,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -16,8 +16,8 @@ Parameters
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-crashdumps
|
||||
📂C:\Users\Markus\AppData\Local\CrashDumps entered (has 3 files and 0 folders)
|
||||
PS> ./cd-crashdumps.ps1
|
||||
📂C:\Users\Markus\AppData\Local\CrashDumps with 3 files entered.
|
||||
|
||||
```
|
||||
|
||||
@ -38,8 +38,8 @@ Script Content
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the crash dumps directory (Windows only). Whenever a software crashes and crash dumps are enabled(!) a crash dump file is written. This file helps to identify the reason for the crash.
|
||||
.EXAMPLE
|
||||
PS> ./cd-crashdumps
|
||||
📂C:\Users\Markus\AppData\Local\CrashDumps entered (has 3 files and 0 folders)
|
||||
PS> ./cd-crashdumps.ps1
|
||||
📂C:\Users\Markus\AppData\Local\CrashDumps with 3 files entered.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -54,10 +54,10 @@ try {
|
||||
|
||||
$path += "\AppData\Local\CrashDumps"
|
||||
if (!(Test-Path "$path" -pathType container)) { throw "No crashdumps folder at $path" }
|
||||
Set-Location "$Path"
|
||||
|
||||
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)"
|
||||
"📂$path with $($files.Count) files entered."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -16,8 +16,8 @@ Parameters
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-desktop
|
||||
📂/home/Markus/Desktop
|
||||
PS> ./cd-desktop.ps1
|
||||
📂/home/Markus/Desktop with 3 files and 0 folders entered.
|
||||
|
||||
```
|
||||
|
||||
@ -38,8 +38,8 @@ Script Content
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the user's desktop folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-desktop
|
||||
📂/home/Markus/Desktop
|
||||
PS> ./cd-desktop.ps1
|
||||
📂/home/Markus/Desktop with 3 files and 0 folders entered.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -49,17 +49,19 @@ Script Content
|
||||
try {
|
||||
if ($IsLinux -or $IsMacOS) {
|
||||
if (-not(Test-Path "~/Desktop" -pathType container)) {
|
||||
throw "No 📂Desktop folder in your home directory yet"
|
||||
throw "No 'Desktop' folder in your home directory yet"
|
||||
}
|
||||
$path = Resolve-Path "~/Desktop"
|
||||
} else {
|
||||
$path = [Environment]::GetFolderPath('DesktopDirectory')
|
||||
if (-not(Test-Path "$path" -pathType container)) {
|
||||
throw "No desktop folder at 📂$path yet"
|
||||
throw "Desktop folder at $path does not exist yet"
|
||||
}
|
||||
}
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
$files = Get-ChildItem $path -attributes !Directory
|
||||
$folders = Get-ChildItem $path -attributes Directory
|
||||
"📂$path with $($files.Count) files and $($folders.Count) folders entered."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -67,4 +69,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -1,7 +1,7 @@
|
||||
The *cd-docs.ps1* Script
|
||||
===========================
|
||||
|
||||
This PowerShell script changes the working directory to the documents folder.
|
||||
This PowerShell script sets the current working directory to the documents folder.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@ -16,8 +16,8 @@ Parameters
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-docs
|
||||
📂C:\Users\Markus\Documents entered (has 3 files and 0 folders)
|
||||
PS> ./cd-docs.ps1
|
||||
📂C:\Users\Markus\Documents with 3 files and 0 folders entered.
|
||||
|
||||
```
|
||||
|
||||
@ -34,12 +34,12 @@ Script Content
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the working directory to the documents folder
|
||||
Sets the working dir to the documents folder
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the documents folder.
|
||||
This PowerShell script sets the current working directory to the documents folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-docs
|
||||
📂C:\Users\Markus\Documents entered (has 3 files and 0 folders)
|
||||
PS> ./cd-docs.ps1
|
||||
📂C:\Users\Markus\Documents with 3 files and 0 folders entered.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -49,19 +49,19 @@ Script Content
|
||||
try {
|
||||
if ($IsLinux -or $IsMacOS) {
|
||||
if (-not(Test-Path "~/Documents" -pathType container)) {
|
||||
throw "No 📂Documents folder in your home directory yet"
|
||||
throw "No 'Documents' folder in your home directory yet"
|
||||
}
|
||||
$path = Resolve-Path "~/Documents"
|
||||
} else {
|
||||
$path = [Environment]::GetFolderPath('MyDocuments')
|
||||
if (-not(Test-Path "$path" -pathType container)) {
|
||||
throw "No documents folder at 📂$path yet"
|
||||
throw "No documents folder at: $path 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)"
|
||||
"📂$path with $($files.Count) files and $($folders.Count) folders entered."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -69,4 +69,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -16,8 +16,8 @@ Parameters
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-downloads
|
||||
📂C:\Users\Markus\Downloads entered (has 0 files and 0 folders)
|
||||
PS> ./cd-downloads.ps1
|
||||
📂C:\Users\Markus\Downloads with 0 files and 0 folders entered.
|
||||
|
||||
```
|
||||
|
||||
@ -38,8 +38,8 @@ Script Content
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the user's downloads folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-downloads
|
||||
📂C:\Users\Markus\Downloads entered (has 0 files and 0 folders)
|
||||
PS> ./cd-downloads.ps1
|
||||
📂C:\Users\Markus\Downloads with 0 files and 0 folders entered.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -49,19 +49,19 @@ Script Content
|
||||
try {
|
||||
if ($IsLinux -or $IsMacOS) {
|
||||
if (-not(Test-Path "~/Downloads" -pathType container)) {
|
||||
throw "No 📂Downloads folder in your home directory yet"
|
||||
throw "No 'Downloads' folder in your home directory yet"
|
||||
}
|
||||
$path = Resolve-Path "~/Downloads"
|
||||
} 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"
|
||||
throw "No downloads folder at: $path"
|
||||
}
|
||||
}
|
||||
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)"
|
||||
"📂$path with $($files.Count) files and $($folders.Count) folders entered."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -69,4 +69,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-dropbox
|
||||
📂C:\Users\Markus\Dropbox (has 2 files and 4 subfolders)
|
||||
📂C:\Users\Markus\Dropbox (has 2 files and 0 folders)
|
||||
|
||||
```
|
||||
|
||||
@ -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 (has 2 files and 4 subfolders)
|
||||
📂C:\Users\Markus\Dropbox (has 2 files and 0 folders)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -48,13 +48,13 @@ Script Content
|
||||
|
||||
try {
|
||||
if (-not(Test-Path "~/Dropbox" -pathType container)) {
|
||||
throw "No 📂Dropbox folder in your home directory - is Dropbox installed?"
|
||||
throw "No 'Dropbox' folder in your home directory - is Dropbox installed?"
|
||||
}
|
||||
$path = Resolve-Path "~/Dropbox"
|
||||
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)"
|
||||
"📂$path entered (has $($files.Count) files and $($folders.Count) folders)"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -62,4 +62,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-etc
|
||||
📂C:\Windows\System32\drivers\etc (has 2 files and 3 subfolders)
|
||||
📂C:\Windows\System32\drivers\etc (has 5 files and 0 folders)
|
||||
|
||||
```
|
||||
|
||||
@ -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 (has 2 files and 3 subfolders)
|
||||
📂C:\Windows\System32\drivers\etc (has 5 files and 0 folders)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -53,12 +53,12 @@ try {
|
||||
$path = Resolve-Path "$env:WINDIR\System32\drivers\etc"
|
||||
}
|
||||
if (-not(Test-Path "$path" -pathType container)) {
|
||||
throw "No /etc directory at 📂$path"
|
||||
throw "No 'etc' folder found at: $path"
|
||||
}
|
||||
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)"
|
||||
"📂$path entered (has $($files.Count) files and $($folders.Count) folders)"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -66,4 +66,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -1,7 +1,7 @@
|
||||
The *cd-fonts.ps1* Script
|
||||
===========================
|
||||
|
||||
This PowerShell script changes the working directory to the fonts folder.
|
||||
This PowerShell script sets the current working directory to the fonts folder.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@ -16,8 +16,8 @@ Parameters
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-fonts
|
||||
📂C:\Windows\Fonts (has 2 file and 3 subfolders)
|
||||
PS> ./cd-fonts.ps1
|
||||
📂C:\Windows\Fonts with 12 font files entered.
|
||||
|
||||
```
|
||||
|
||||
@ -34,12 +34,12 @@ Script Content
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the working directory to the fonts folder
|
||||
Sets the working dir to the fonts folder
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the fonts folder.
|
||||
This PowerShell script sets the current working directory to the fonts folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-fonts
|
||||
📂C:\Windows\Fonts (has 2 file and 3 subfolders)
|
||||
PS> ./cd-fonts.ps1
|
||||
📂C:\Windows\Fonts with 12 font files entered.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -49,12 +49,11 @@ Script Content
|
||||
try {
|
||||
$path = [Environment]::GetFolderPath('Fonts')
|
||||
if (-not(Test-Path "$path" -pathType container)) {
|
||||
throw "No fonts folder at 📂$path"
|
||||
throw "No fonts folder at: $path"
|
||||
}
|
||||
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)"
|
||||
"📂$path with $($files.Count) font files entered."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -62,4 +61,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-home.ps1
|
||||
📂C:\Users\Markus entered (has 4 files and 7 subfolders)
|
||||
📂C:\Users\Markus with 4 files and 7 folders entered.
|
||||
|
||||
```
|
||||
|
||||
@ -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 entered (has 4 files and 7 subfolders)
|
||||
📂C:\Users\Markus with 4 files and 7 folders entered.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -47,12 +47,12 @@ Script Content
|
||||
#>
|
||||
|
||||
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 "~"
|
||||
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)"
|
||||
"📂$path with $($files.Count) files and $($folders.Count) folders entered."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -50,4 +50,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -16,8 +16,8 @@ Parameters
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-music
|
||||
📂C:\Users\Markus\Music entered (has 0 files and 3 subfolders)
|
||||
PS> ./cd-music.ps1
|
||||
📂C:\Users\Markus\Music with 3 folders and 0 files entered.
|
||||
|
||||
```
|
||||
|
||||
@ -38,8 +38,8 @@ Script Content
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the user's music folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-music
|
||||
📂C:\Users\Markus\Music entered (has 0 files and 3 subfolders)
|
||||
PS> ./cd-music.ps1
|
||||
📂C:\Users\Markus\Music with 3 folders and 0 files entered.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -48,17 +48,20 @@ Script Content
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
if (-not(Test-Path "~/Music/" -pathType container)) {
|
||||
throw "No 'Music' folder in home directory"
|
||||
}
|
||||
$path = Resolve-Path "~/Music"
|
||||
} else {
|
||||
$path = [Environment]::GetFolderPath('MyMusic')
|
||||
}
|
||||
if (-not(Test-Path "$path" -pathType container)) {
|
||||
throw "No music folder at 📂$path"
|
||||
throw "No music folder at: $path"
|
||||
}
|
||||
}
|
||||
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)"
|
||||
$files = Get-ChildItem $path -attributes !Directory
|
||||
"📂$path with $($folders.Count) folders and $($files.Count) files entered."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -66,4 +69,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-nextcloud
|
||||
📂C:\Users\Markus\NextCloud entered (has 2 files and 3 subfolders)
|
||||
📂C:\Users\Markus\NextCloud entered (has 2 files and 0 folders)
|
||||
|
||||
```
|
||||
|
||||
@ -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 entered (has 2 files and 3 subfolders)
|
||||
📂C:\Users\Markus\NextCloud entered (has 2 files and 0 folders)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -47,14 +47,14 @@ 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 "~/NextCloud" -pathType container)) {
|
||||
throw "No 'NextCloud' folder in your home directory - is NextCloud installed?"
|
||||
}
|
||||
$path = Resolve-Path "~/NextCloud"
|
||||
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)"
|
||||
"📂$path entered (has $($files.Count) files and $($folders.Count) folders)"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -62,4 +62,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -1,7 +1,7 @@
|
||||
The *cd-onedrive.ps1* Script
|
||||
===========================
|
||||
|
||||
This PowerShell script changes the working directory to the user's OneDrive folder.
|
||||
This PowerShell script sets the current working directory to the user's OneDrive folder.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@ -16,8 +16,8 @@ Parameters
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-onedrive
|
||||
📂C:\Users\Markus\OneDrive entered (has 2 files and 3 subfolders)
|
||||
PS> ./cd-onedrive.ps1
|
||||
📂C:\Users\Markus\OneDrive with 2 files and 0 folders entered.
|
||||
|
||||
```
|
||||
|
||||
@ -34,12 +34,12 @@ Script Content
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the working directory to the user's OneDrive folder
|
||||
Sets the working dir to the OneDrive folder
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the user's OneDrive folder.
|
||||
This PowerShell script sets the current working directory to the user's OneDrive folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-onedrive
|
||||
📂C:\Users\Markus\OneDrive entered (has 2 files and 3 subfolders)
|
||||
PS> ./cd-onedrive.ps1
|
||||
📂C:\Users\Markus\OneDrive with 2 files and 0 folders entered.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -47,14 +47,14 @@ 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 "~/OneDrive" -pathType container)) {
|
||||
throw "No 'OneDrive' folder in your home directory - is OneDrive installed?"
|
||||
}
|
||||
$path = Resolve-Path "~/OneDrive"
|
||||
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)"
|
||||
"📂$path with $($files.Count) files and $($folders.Count) folders entered."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -62,4 +62,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -1,7 +1,7 @@
|
||||
The *cd-pics.ps1* Script
|
||||
===========================
|
||||
|
||||
This PowerShell script changes the working directory to the user's pictures folder.
|
||||
This PowerShell script sets the current working directory to the user's pictures folder.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@ -16,8 +16,8 @@ Parameters
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-pics
|
||||
📂C:\Users\Markus\Pictures entered (has 7 files and 0 subfolders)
|
||||
PS> ./cd-pics.ps1
|
||||
📂C:\Users\Markus\Pictures with 7 files and 0 folders entered.
|
||||
|
||||
```
|
||||
|
||||
@ -34,12 +34,12 @@ Script Content
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the working directory to the user's pictures folder
|
||||
Sets the working dir to the user's pictures folder
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the user's pictures folder.
|
||||
This PowerShell script sets the current working directory to the user's pictures folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-pics
|
||||
📂C:\Users\Markus\Pictures entered (has 7 files and 0 subfolders)
|
||||
PS> ./cd-pics.ps1
|
||||
📂C:\Users\Markus\Pictures with 7 files and 0 folders entered.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -48,17 +48,20 @@ Script Content
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
if (-not(Test-Path "~/Pictures" -pathType container)) {
|
||||
throw "No 'Pictures' folder in your home directory yet"
|
||||
}
|
||||
$path = Resolve-Path "~/Pictures"
|
||||
} else {
|
||||
$path = [Environment]::GetFolderPath('MyPictures')
|
||||
}
|
||||
if (-not(Test-Path "$path" -pathType container)) {
|
||||
throw "No pictures folder at $path"
|
||||
throw "No pictures folder at: $path"
|
||||
}
|
||||
}
|
||||
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)"
|
||||
"📂$path with $($files.Count) files and $($folders.Count) folders entered."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -66,4 +69,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -1,7 +1,7 @@
|
||||
The *cd-public.ps1* Script
|
||||
===========================
|
||||
|
||||
This PowerShell script changes the working directory to the Public folder.
|
||||
This PowerShell script sets the current working directory to the Public folder.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@ -16,8 +16,8 @@ Parameters
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-public
|
||||
📂C:\Users\Public entered (has 2 files and 3 subfolders)
|
||||
PS> ./cd-public.ps1
|
||||
📂C:\Users\Public with 2 files and 3 folders entered.
|
||||
|
||||
```
|
||||
|
||||
@ -34,12 +34,12 @@ Script Content
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the working directory to the Public folder
|
||||
Sets the working dir to the Public folder
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the Public folder.
|
||||
This PowerShell script sets the current working directory to the Public folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-public
|
||||
📂C:\Users\Public entered (has 2 files and 3 subfolders)
|
||||
PS> ./cd-public.ps1
|
||||
📂C:\Users\Public with 2 files and 3 folders entered.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -48,17 +48,20 @@ Script Content
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
if (-not(Test-Path "~/Public" -pathType container)) {
|
||||
throw "No 'Public' folder in your home directory yet"
|
||||
}
|
||||
$path = Resolve-Path "~/Public"
|
||||
} else {
|
||||
$path = Resolve-Path "~/../Public"
|
||||
if (-not(Test-Path "~/../Public" -pathType container)) {
|
||||
throw "No 'Public' folder yet"
|
||||
}
|
||||
if (-not(Test-Path "$path" -pathType container)) {
|
||||
throw "No public folder at $path"
|
||||
$path = Resolve-Path "~/../Public"
|
||||
}
|
||||
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)"
|
||||
"📂$path with $($files.Count) files and $($folders.Count) folders entered."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -66,4 +69,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -62,4 +62,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -57,4 +57,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -90,4 +90,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-repos.ps1
|
||||
📂C:\Repos (has 33 subfolders)
|
||||
📂C:\Repos with 33 folders entered.
|
||||
|
||||
```
|
||||
|
||||
@ -39,7 +39,7 @@ Script Content
|
||||
This PowerShell script changes the working directory to the folder for Git repositories.
|
||||
.EXAMPLE
|
||||
PS> ./cd-repos.ps1
|
||||
📂C:\Repos (has 33 subfolders)
|
||||
📂C:\Repos with 33 folders entered.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -57,13 +57,11 @@ try {
|
||||
} 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 folder found for Git repositories (in home or root directory) - Please create one."
|
||||
}
|
||||
} else { throw "Found no folder for Git repositories (in home or root directory) - Please create one." }
|
||||
$path = Resolve-Path $path
|
||||
Set-Location "$path"
|
||||
$subfolders = Get-ChildItem $path -attributes Directory
|
||||
"📂$path entered (has $($subfolders.Count) subfolders)"
|
||||
$folders = Get-ChildItem $path -attributes Directory
|
||||
"📂$path with $($folders.Count) folders entered."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -71,4 +69,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -16,8 +16,8 @@ Parameters
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-root
|
||||
📂C:\ entered (has 0 files and 7 folders)
|
||||
PS> ./cd-root.ps1
|
||||
📂C:\ with 7 folders and 0 files entered.
|
||||
|
||||
```
|
||||
|
||||
@ -34,12 +34,12 @@ Script Content
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the working directory to the root directory
|
||||
Sets the working dir to the root dir
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the current working directory to the root directory (C:\ on Windows).
|
||||
.EXAMPLE
|
||||
PS> ./cd-root
|
||||
📂C:\ entered (has 0 files and 7 folders)
|
||||
PS> ./cd-root.ps1
|
||||
📂C:\ with 7 folders and 0 files entered.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -47,11 +47,11 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
if ($IsLinux) { $path = "/" } else { $path = "C:\" }
|
||||
if ($IsLinux -or $IsMacOS) { $path = "/" } else { $path = "C:\" }
|
||||
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)"
|
||||
$files = Get-ChildItem $path -attributes !Directory
|
||||
"📂$path with $($folders.Count) folders and $($files.Count) files entered."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -59,4 +59,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -19,12 +19,12 @@ Script Content
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the working directory to the user's screenshots folder
|
||||
Sets the working dir to the user's screenshots folder
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the user's screenshots folder.
|
||||
This PowerShell script sets the current working directory to the user's screenshots folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-screenshots
|
||||
📂C:\Users\Markus\Pictures\Screenshots (has 7 files and 0 folders)
|
||||
PS> ./cd-screenshots.ps1
|
||||
📂C:\Users\Markus\Pictures\Screenshots with 7 files and 0 folders entered.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -33,12 +33,12 @@ Script Content
|
||||
|
||||
function GetScreenshotsFolder {
|
||||
if ($IsLinux) {
|
||||
if (-not(Test-Path "~/Pictures" -pathType container)) { throw "No 'Pictures' folder in your home directory yet" }
|
||||
$path = "~/Pictures"
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "Pictures folder at $path doesn't exist (yet)" }
|
||||
if (Test-Path "$path/Screenshots" -pathType container) { $path = "$path/Screenshots" }
|
||||
} 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" }
|
||||
if (Test-Path "$path\Screenshots" -pathType container) { $path = "$path\Screenshots" }
|
||||
}
|
||||
return $path
|
||||
@ -49,7 +49,7 @@ try {
|
||||
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)"
|
||||
"📂$path with $($files.Count) files and $($folders.Count) folders entered."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -57,4 +57,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-scripts.ps1
|
||||
📂C:\Repos\PowerShell\scripts entered (has 645 scripts)
|
||||
📂C:\Repos\PowerShell\scripts with 655 scripts entered.
|
||||
|
||||
```
|
||||
|
||||
@ -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 entered (has 645 scripts)
|
||||
📂C:\Repos\PowerShell\scripts with 655 scripts entered.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -48,12 +48,10 @@ Script Content
|
||||
|
||||
try {
|
||||
$path = Resolve-Path "$PSScriptRoot"
|
||||
if (-not(Test-Path "$path" -pathType container)) {
|
||||
throw "No PowerShell scripts folder at 📂$path"
|
||||
}
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "No scripts folder at: $path" }
|
||||
Set-Location "$path"
|
||||
$files = Get-ChildItem $path -attributes !Directory
|
||||
"📂$path entered (has $($files.Count) scripts)"
|
||||
"📂$path with $($files.Count) scripts entered."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -61,4 +59,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -1,7 +1,7 @@
|
||||
The *cd-ssh.ps1* Script
|
||||
===========================
|
||||
|
||||
This PowerShell script changes the working directory to the user's secure shell (SSH) folder.
|
||||
This PowerShell script sets the current working directory to the user's secure shell (SSH) folder.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-ssh.ps1
|
||||
📂C:\Users\Markus\.ssh entered (has 4 files)
|
||||
📂C:\Users\Markus\.ssh with 4 files entered.
|
||||
|
||||
```
|
||||
|
||||
@ -34,12 +34,12 @@ Script Content
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the working directory to the SSH folder
|
||||
Sets the working dir to the SSH folder
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the user's secure shell (SSH) folder.
|
||||
This PowerShell script sets the current working directory to the user's secure shell (SSH) folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-ssh.ps1
|
||||
📂C:\Users\Markus\.ssh entered (has 4 files)
|
||||
📂C:\Users\Markus\.ssh with 4 files entered.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -49,12 +49,12 @@ Script Content
|
||||
try {
|
||||
$path = "~/.ssh"
|
||||
if (-not(Test-Path "$path" -pathType container)) {
|
||||
throw "No secure shell (SSH) folder at $path"
|
||||
throw "No '.ssh' folder in your home directory yet - Is SSH installed?"
|
||||
}
|
||||
$path = Resolve-Path "$path"
|
||||
Set-Location "$path"
|
||||
$files = Get-ChildItem $path -attributes !Directory
|
||||
"📂$path entered (has $($files.Count) files)"
|
||||
"📂$path with $($files.Count) files entered."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -62,4 +62,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
65
docs/cd-sync.md
Normal file
65
docs/cd-sync.md
Normal file
@ -0,0 +1,65 @@
|
||||
The *cd-sync.ps1* Script
|
||||
===========================
|
||||
|
||||
This PowerShell script changes the working directory to the user's Syncthing folder.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
/Repos/PowerShell/scripts/cd-sync.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
||||
```
|
||||
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-sync.ps1
|
||||
📂C:\Users\Markus\Sync entered (has 2 files and 0 folders)
|
||||
|
||||
```
|
||||
|
||||
Notes
|
||||
-----
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
|
||||
Related Links
|
||||
-------------
|
||||
https://github.com/fleschutz/PowerShell
|
||||
|
||||
Script Content
|
||||
--------------
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the working directory to the user's Sync folder
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the user's Syncthing folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-sync.ps1
|
||||
📂C:\Users\Markus\Sync entered (has 2 files and 0 folders)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
if (-not(Test-Path "~/Sync" -pathType container)) {
|
||||
throw "No 'Sync' folder in your home directory - is Syncthing installed?"
|
||||
}
|
||||
$path = Resolve-Path "~/Sync"
|
||||
Set-Location "$path"
|
||||
$files = Get-ChildItem $path -attributes !Directory
|
||||
$folders = Get-ChildItem $path -attributes Directory
|
||||
"📂$path entered (has $($files.Count) files and $($folders.Count) folders)"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
@ -54,4 +54,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -1,7 +1,7 @@
|
||||
The *cd-templates.ps1* Script
|
||||
===========================
|
||||
|
||||
This PowerShell script changes the working directory to the templates folder.
|
||||
This PowerShell script sets the current working directory to the templates folder.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@ -16,8 +16,8 @@ Parameters
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-templates
|
||||
📂/home/Markus/Templates entered (has 3 files and 0 subfolders)
|
||||
PS> ./cd-templates.ps1
|
||||
📂/home/Markus/Templates with 3 files and 0 folders entered.
|
||||
|
||||
```
|
||||
|
||||
@ -34,12 +34,12 @@ Script Content
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the working directory to the templates folder
|
||||
Sets the working dir to the templates folder
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the templates folder.
|
||||
This PowerShell script sets the current working directory to the templates folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-templates
|
||||
📂/home/Markus/Templates entered (has 3 files and 0 subfolders)
|
||||
PS> ./cd-templates.ps1
|
||||
📂/home/Markus/Templates with 3 files and 0 folders entered.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -48,17 +48,20 @@ Script Content
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
if (-not(Test-Path "~/Templates" -pathType container)) {
|
||||
throw "No 'Templates' folder in your home directory yet"
|
||||
}
|
||||
$path = Resolve-Path "~/Templates"
|
||||
} else {
|
||||
$path = [Environment]::GetFolderPath('Templates')
|
||||
}
|
||||
if (-not(Test-Path "$path" -pathType container)) {
|
||||
throw "No templates folder at $path"
|
||||
throw "No templates folder at: $path"
|
||||
}
|
||||
}
|
||||
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)"
|
||||
"📂$path with $($files.Count) files and $($folders.Count) folders entered."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -66,4 +69,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -57,4 +57,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -1,7 +1,7 @@
|
||||
The *cd-users.ps1* Script
|
||||
===========================
|
||||
|
||||
This PowerShell script changes the working directory to the users directory.
|
||||
This PowerShell script sets the current working directory to the users directory.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@ -16,8 +16,8 @@ Parameters
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-users
|
||||
📂C:\Users entered (has 0 files and 4 subfolders)
|
||||
PS> ./cd-users.ps1
|
||||
📂C:\Users with 4 folders entered.
|
||||
|
||||
```
|
||||
|
||||
@ -34,12 +34,12 @@ Script Content
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the working directory to the users directory
|
||||
Sets the working dir to the users directory
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the users directory.
|
||||
This PowerShell script sets the current working directory to the users directory.
|
||||
.EXAMPLE
|
||||
PS> ./cd-users
|
||||
📂C:\Users entered (has 0 files and 4 subfolders)
|
||||
PS> ./cd-users.ps1
|
||||
📂C:\Users with 4 folders entered.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -49,12 +49,11 @@ Script Content
|
||||
try {
|
||||
$path = Resolve-Path "~/.."
|
||||
if (-not(Test-Path "$path" -pathType container)) {
|
||||
throw "No users directory at $path"
|
||||
throw "No users directory at: $path"
|
||||
}
|
||||
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)"
|
||||
"📂$path with $($folders.Count) folders entered."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -62,4 +61,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -66,4 +66,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-windows
|
||||
📂C:\Windows entered (has 7 files and 42 subfolders)
|
||||
📂C:\Windows entered (has 7 files and 42 folders)
|
||||
|
||||
```
|
||||
|
||||
@ -39,7 +39,7 @@ Script Content
|
||||
This PowerShell script changes the working directory to the Windows directory.
|
||||
.EXAMPLE
|
||||
PS> ./cd-windows
|
||||
📂C:\Windows entered (has 7 files and 42 subfolders)
|
||||
📂C:\Windows entered (has 7 files and 42 folders)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -54,7 +54,7 @@ try {
|
||||
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)"
|
||||
"📂$path entered (has $($files.Count) files and $($folders.Count) folders)"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -62,4 +62,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -80,4 +80,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -67,4 +67,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -72,4 +72,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -75,4 +75,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -104,4 +104,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -83,4 +83,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -57,4 +57,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -72,4 +72,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -37,7 +37,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-drive-space.ps1 C
|
||||
✅ Drive C: uses 56% of 1TB - 442GB free
|
||||
✅ Drive C: uses 56% of 1TB: 442GB free
|
||||
|
||||
```
|
||||
|
||||
@ -63,7 +63,7 @@ Script Content
|
||||
Specifies the minimum level in bytes (10GB by default)
|
||||
.EXAMPLE
|
||||
PS> ./check-drive-space.ps1 C
|
||||
✅ Drive C: uses 56% of 1TB - 442GB free
|
||||
✅ Drive C: uses 56% of 1TB: 442GB free
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -103,7 +103,7 @@ try {
|
||||
Write-Host "⚠️ Drive $driveName with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free"
|
||||
} else {
|
||||
[int64]$percent = ($used * 100) / $total
|
||||
Write-Host "✅ Drive $driveName uses $percent% of $(Bytes2String $total) - $(Bytes2String $free) free"
|
||||
Write-Host "✅ Drive $driveName uses $percent% of $(Bytes2String $total): $(Bytes2String $free) free"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
@ -112,4 +112,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -103,4 +103,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -63,4 +63,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -61,4 +61,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -76,4 +76,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -171,4 +171,4 @@ function Check-Header { param( $path )
|
||||
Check-Header $Path
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -67,4 +67,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -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 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -58,4 +58,4 @@ Script Content
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -61,4 +61,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -85,4 +85,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -99,4 +99,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -55,4 +55,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -88,4 +88,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -57,4 +57,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -76,4 +76,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -59,4 +59,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -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 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -59,4 +59,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -73,4 +73,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -95,4 +95,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:34)*
|
||||
|
@ -90,4 +90,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -91,4 +91,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -59,4 +59,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -77,4 +77,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -98,4 +98,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -130,4 +130,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -92,4 +92,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -56,4 +56,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -120,4 +120,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -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 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -85,4 +85,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -99,7 +99,7 @@ try {
|
||||
Write-Output "✅ Swap space has $(MB2String $total) reserved."
|
||||
} else {
|
||||
[int64]$percent = ($used * 100) / $total
|
||||
Write-Output "✅ Swap space at $(MB2String $used) ($percent%) of $(MB2String $total)."
|
||||
Write-Output "✅ Swap space uses $percent% of $(MB2String $total): $(MB2String $free) free"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
@ -108,4 +108,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -99,4 +99,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -66,4 +66,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -114,4 +114,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -82,4 +82,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -54,4 +54,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -73,4 +73,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -86,4 +86,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -9,7 +9,7 @@ Parameters
|
||||
/Repos/PowerShell/scripts/check-xml-files.ps1 [[-path] <String>] [<CommonParameters>]
|
||||
|
||||
-path <String>
|
||||
Specifies the path to the directory tree (current working dir by default)
|
||||
Specifies the file path to the directory tree (current working dir by default)
|
||||
|
||||
Required? false
|
||||
Position? 1
|
||||
@ -49,7 +49,7 @@ Script Content
|
||||
.DESCRIPTION
|
||||
This PowerShell script verifies any XML file (with suffix .xml) in the given directory tree for validity.
|
||||
.PARAMETER path
|
||||
Specifies the path to the directory tree (current working dir by default)
|
||||
Specifies the file path to the directory tree (current working dir by default)
|
||||
.EXAMPLE
|
||||
PS> ./check-xml-files.ps1 C:\Windows
|
||||
...
|
||||
@ -65,23 +65,24 @@ param([string]$path = "$PWD")
|
||||
try {
|
||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
$path = Resolve-Path "$path"
|
||||
Write-Progress "Scanning any XML file within $path..."
|
||||
[int]$valid = [int]$invalid = 0
|
||||
|
||||
Get-ChildItem -path "$path" -attributes !Directory -recurse -force | Where-Object { $_.Name -like "*.xml" } | Foreach-Object {
|
||||
& $PSScriptRoot/check-xml-file.ps1 "$($_.FullName)"
|
||||
if ($lastExitCode -eq 0) { $valid++ } else { $invalid++ }
|
||||
}
|
||||
Write-Progress -completed "Done."
|
||||
|
||||
[int]$total = $valid + $invalid
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✅ Checked $total XML files ($invalid invalid, $valid valid) within 📂$path in $elapsed sec"
|
||||
if ($invalid -ne 0) {
|
||||
"⚠️ $invalid XML files are INVALID, $valid are valid (took $($elapsed)s)."
|
||||
} else {
|
||||
"✅ All $valid XML files are valid (took $($elapsed)s)."
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
"⚠️ Error: $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -99,4 +99,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -101,4 +101,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -119,4 +119,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
@ -75,4 +75,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:35)*
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user