mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-06 13:07:02 +02:00
Updated the manuals
This commit is contained in:
parent
b3cdf19f4a
commit
09eb3d1808
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value
|
Default value
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
-Direction <String>
|
-Direction <String>
|
||||||
@ -24,6 +25,7 @@ Parameters
|
|||||||
Position? 2
|
Position? 2
|
||||||
Default value Inbound
|
Default value Inbound
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
-FirewallProfile <Array>
|
-FirewallProfile <Array>
|
||||||
@ -32,6 +34,7 @@ Parameters
|
|||||||
Position? 3
|
Position? 3
|
||||||
Default value @("Domain", "Private")
|
Default value @("Domain", "Private")
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value
|
Default value
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<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)*
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
The *build-repo.ps1* Script
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
@ -9,12 +9,13 @@ Parameters
|
|||||||
/Repos/PowerShell/scripts/build-repo.ps1 [[-path] <String>] [<CommonParameters>]
|
/Repos/PowerShell/scripts/build-repo.ps1 [[-path] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-path <String>
|
-path <String>
|
||||||
Specifies the path to the Git repository (default is current working directory)
|
Specifies the path to the Git repository (current working directory by default)
|
||||||
|
|
||||||
Required? false
|
Required? false
|
||||||
Position? 1
|
Position? 1
|
||||||
Default value "$PWD"
|
Default value "$PWD"
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
@ -26,9 +27,9 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./build-repo.ps1 C:\Repos\ninja
|
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
|
```powershell
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Builds a repository
|
Builds a repo
|
||||||
.DESCRIPTION
|
.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
|
.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
|
.EXAMPLE
|
||||||
PS> ./build-repo.ps1 C:\Repos\ninja
|
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
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -63,114 +64,114 @@ Script Content
|
|||||||
|
|
||||||
param([string]$path = "$PWD")
|
param([string]$path = "$PWD")
|
||||||
|
|
||||||
function BuildInDir([string]$path) {
|
function BuildFolder([string]$path) {
|
||||||
$dirName = (Get-Item "$path").Name
|
$dirName = (Get-Item "$path").Name
|
||||||
if (Test-Path "$path/CMakeLists.txt" -pathType leaf) {
|
if (Test-Path "$path/CMakeLists.txt" -pathType leaf) {
|
||||||
"⏳ (1/4) Building 📂$dirName by using CMake into 📂$dirName/_Build_Results..."
|
"⏳ (1/4) Building 📂$dirName by using CMake..."
|
||||||
if (-not(Test-Path "$path/_Build_Results/" -pathType container)) {
|
$global:results = "$path/_results/"
|
||||||
& mkdir "$path/_Build_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..."
|
"⏳ (2/4) Executing 'cmake' to generate the Makefile..."
|
||||||
& cmake ..
|
& 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..."
|
"⏳ (3/4) Executing 'make -j4' to compile and link..."
|
||||||
& make -j4
|
& 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
|
& 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) {
|
} elseif (Test-Path "$path/autogen.sh" -pathType leaf) {
|
||||||
"⏳ Building 📂$dirName by using 'autogen.sh'..."
|
"⏳ Building 📂$dirName by executing 'autogen.sh'..."
|
||||||
Set-Location "$path/"
|
Set-Location "$path/"
|
||||||
|
|
||||||
& ./autogen.sh --force
|
& ./autogen.sh --force
|
||||||
if ($lastExitCode -ne "0") { throw "Executing './autogen.sh --force' exited with error code $lastExitCode" }
|
if ($lastExitCode -ne 0) { throw "Executing './autogen.sh --force' failed with exit code $lastExitCode" }
|
||||||
|
"⏳ Executing './configure'..."
|
||||||
|
|
||||||
& ./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
|
& 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) {
|
} elseif (Test-Path "$path/configure" -pathType leaf) {
|
||||||
"⏳ Building 📂$dirName by using 'configure'..."
|
"⏳ Building 📂$dirName by executing './configure' and 'make'..."
|
||||||
Set-Location "$path/"
|
Set-Location "$path/"
|
||||||
|
|
||||||
& ./configure
|
& ./configure
|
||||||
#if ($lastExitCode -ne "0") { throw "Executing './configure' exited with error code $lastExitCode" }
|
#if ($lastExitCode -ne 0) { throw "Executing './configure' exited with error code $lastExitCode" }
|
||||||
|
|
||||||
& make -j4
|
& 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
|
& 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) {
|
} elseif (Test-Path "$path/build.gradle" -pathType leaf) {
|
||||||
"⏳ Building 📂$dirName by using Gradle..."
|
"⏳ Building 📂$dirName by using Gradle..."
|
||||||
Set-Location "$path"
|
Set-Location "$path"
|
||||||
|
|
||||||
& gradle build
|
& 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
|
& 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) {
|
} elseif (Test-Path "$path/meson.build" -pathType leaf) {
|
||||||
"⏳ Building 📂$dirName by using Meson..."
|
"⏳ Building 📂$dirName by using Meson..."
|
||||||
Set-Location "$path"
|
Set-Location "$path"
|
||||||
& meson . build --prefix=/usr/local
|
& meson . build --prefix=/usr/local
|
||||||
if ($lastExitCode -ne "0") { throw "Executing 'meson . build' 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) {
|
} elseif (Test-Path "$path/Imakefile" -pathType leaf) {
|
||||||
"⏳ Building 📂$dirName by using Imakefile..."
|
"⏳ Building 📂$dirName by using Imakefile..."
|
||||||
Set-Location "$path/"
|
Set-Location "$path/"
|
||||||
|
|
||||||
& xmkmf
|
& xmkmf
|
||||||
if ($lastExitCode -ne "0") { throw "Executing 'xmkmf' has failed" }
|
if ($lastExitCode -ne 0) { throw "Executing 'xmkmf' failed with exit code $lastExitCode" }
|
||||||
|
|
||||||
& make -j4
|
& 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) {
|
} elseif (Test-Path "$path/Makefile" -pathType leaf) {
|
||||||
"⏳ Building 📂$dirName by using Makefile..."
|
"⏳ Building 📂$dirName by using Makefile..."
|
||||||
Set-Location "$path"
|
Set-Location "$path"
|
||||||
|
|
||||||
& make -j4
|
& make -j4
|
||||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" }
|
||||||
|
|
||||||
} elseif (Test-Path "$path/makefile" -pathType leaf) {
|
} elseif (Test-Path "$path/makefile" -pathType leaf) {
|
||||||
"⏳ Building 📂$dirName by using makefile..."
|
"⏳ Building 📂$dirName by using makefile..."
|
||||||
Set-Location "$path"
|
Set-Location "$path"
|
||||||
|
|
||||||
& make -j4
|
& make -j4
|
||||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" }
|
||||||
|
|
||||||
} elseif (Test-Path "$path/compile.sh" -pathType leaf) {
|
} elseif (Test-Path "$path/compile.sh" -pathType leaf) {
|
||||||
"⏳ Building 📂$dirName by using 'compile.sh'..."
|
"⏳ Building 📂$dirName by executing 'compile.sh'..."
|
||||||
Set-Location "$path/"
|
Set-Location "$path/"
|
||||||
|
|
||||||
& ./compile.sh
|
& ./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
|
& 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) {
|
} 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
|
Write-Host "⏳ Building 📂$dirName by executing 'build.bat'..."
|
||||||
if ($lastExitCode -ne "0") { throw "Executing 'build.bat build-all-release' exited with error code $lastExitCode" }
|
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) {
|
} elseif (Test-Path "$path/$dirName" -pathType container) {
|
||||||
"⏳ No make rule found, trying subfolder 📂$($dirName)..."
|
"⏳ No make rule found, trying subfolder 📂$($dirName)..."
|
||||||
BuildInDir "$path/$dirName"
|
BuildFolder "$path/$dirName"
|
||||||
} else {
|
} else {
|
||||||
Write-Warning "Sorry, no make rule applies to: 📂$dirName"
|
Write-Warning "Sorry, no make rule applies to: 📂$dirName"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
@ -179,21 +180,27 @@ function BuildInDir([string]$path) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
if (-not(Test-Path "$path" -pathType container)) { throw "Can't access directory: $path" }
|
|
||||||
|
|
||||||
$previousPath = Get-Location
|
$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"
|
Set-Location "$previousPath"
|
||||||
|
|
||||||
$repoDirName = (Get-Item "$path").Name
|
$repoDirName = (Get-Item "$path").Name
|
||||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
[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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Set-Location "$previousPath"
|
||||||
exit 1
|
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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value "$PWD"
|
Default value "$PWD"
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<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)*
|
||||||
|
@ -49,15 +49,15 @@ Script Content
|
|||||||
try {
|
try {
|
||||||
$path = Resolve-Path "~/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup"
|
$path = Resolve-Path "~/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup"
|
||||||
if (-not(Test-Path "$path" -pathType container)) {
|
if (-not(Test-Path "$path" -pathType container)) {
|
||||||
throw "Autostart folder at 📂$path doesn't exist (yet)"
|
throw "No autostart folder at 📂$path"
|
||||||
}
|
}
|
||||||
Set-Location "$path"
|
Set-Location "$path"
|
||||||
"📂$path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-crashdumps
|
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.
|
This PowerShell script changes the working directory to the crash dumps directory (Windows only). Whenever a software crashes and crash dumps are enabled(!) a crash dump file is written. This file helps to identify the reason for the crash.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-crashdumps
|
PS> ./cd-crashdumps
|
||||||
📂C:\Users\Markus\AppData\Local\CrashDumps
|
📂C:\Users\Markus\AppData\Local\CrashDumps entered (has 3 files and 0 folders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -50,17 +50,19 @@ try {
|
|||||||
if ($IsLinux) { throw "Sorry, Windows only" }
|
if ($IsLinux) { throw "Sorry, Windows only" }
|
||||||
|
|
||||||
[string]$path = Resolve-Path -Path "~"
|
[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"
|
$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"
|
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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -47,21 +47,24 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
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"
|
$path = Resolve-Path "~/Desktop"
|
||||||
} else {
|
} else {
|
||||||
$path = [Environment]::GetFolderPath('DesktopDirectory')
|
$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"
|
||||||
Set-Location "$path"
|
"📂$path"
|
||||||
"📂$path"
|
exit 0 # success
|
||||||
exit 0 # success
|
|
||||||
}
|
|
||||||
throw "User's desktop folder at 📂$path doesn't exist (yet)"
|
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
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)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-docs
|
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.
|
This PowerShell script changes the working directory to the documents folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-docs
|
PS> ./cd-docs
|
||||||
📂C:\Users\Markus\Documents
|
📂C:\Users\Markus\Documents entered (has 3 files and 0 folders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -47,21 +47,26 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
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"
|
$path = Resolve-Path "~/Documents"
|
||||||
} else {
|
} else {
|
||||||
$path = [Environment]::GetFolderPath('MyDocuments')
|
$path = [Environment]::GetFolderPath('MyDocuments')
|
||||||
}
|
if (-not(Test-Path "$path" -pathType container)) {
|
||||||
if (-not(Test-Path "$path" -pathType container)) {
|
throw "No documents folder at 📂$path yet"
|
||||||
throw "Documents folder at 📂$path doesn't exist (yet)"
|
}
|
||||||
}
|
}
|
||||||
Set-Location "$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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-downloads
|
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.
|
This PowerShell script changes the working directory to the user's downloads folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-downloads
|
PS> ./cd-downloads
|
||||||
📂C:\Users\Markus\Downloads
|
📂C:\Users\Markus\Downloads entered (has 0 files and 0 folders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -47,21 +47,26 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
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"
|
$path = Resolve-Path "~/Downloads"
|
||||||
} else {
|
} else {
|
||||||
$path = (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path
|
$path = (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path
|
||||||
|
if (-not(Test-Path "$path" -pathType container)) {
|
||||||
|
throw "No downloads folder at 📂$path"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (Test-Path "$path" -pathType container) {
|
Set-Location "$path"
|
||||||
Set-Location "$path"
|
$files = Get-ChildItem $path -attributes !Directory
|
||||||
"📂$path"
|
$folders = Get-ChildItem $path -attributes Directory
|
||||||
exit 0 # success
|
"📂$path entered (has $($files.Count) files and $($folders.Count) folders)"
|
||||||
}
|
exit 0 # success
|
||||||
throw "User's downloads folder at 📂$path doesn't exist (yet)"
|
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
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)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-dropbox
|
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.
|
This PowerShell script changes the working directory to the user's Dropbox folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-dropbox
|
PS> ./cd-dropbox
|
||||||
📂C:\Users\Markus\Dropbox
|
📂C:\Users\Markus\Dropbox (has 2 files and 4 subfolders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -47,10 +47,14 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (-not(Test-Path "~/Dropbox" -pathType container)) {
|
||||||
|
throw "No 📂Dropbox folder in your home directory - is Dropbox installed?"
|
||||||
|
}
|
||||||
$path = Resolve-Path "~/Dropbox"
|
$path = Resolve-Path "~/Dropbox"
|
||||||
if (-not(Test-Path "$path" -pathType container)) { throw "No Dropbox folder at 📂$path - is Dropbox installed?" }
|
|
||||||
Set-Location "$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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0])"
|
"⚠️ 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)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-etc
|
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.
|
This PowerShell script changes the working directory to the /etc directory.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-etc
|
PS> ./cd-etc
|
||||||
📂C:\Windows\System32\drivers\etc
|
📂C:\Windows\System32\drivers\etc (has 2 files and 3 subfolders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -47,21 +47,23 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinx) {
|
if ($IsLinux -or $IsMacOS) {
|
||||||
$path = "/etc"
|
$path = "/etc"
|
||||||
} else {
|
} else {
|
||||||
$path = Resolve-Path "$env:WINDIR\System32\drivers\etc"
|
$path = Resolve-Path "$env:WINDIR\System32\drivers\etc"
|
||||||
}
|
}
|
||||||
if (-not(Test-Path "$path" -pathType container)) {
|
if (-not(Test-Path "$path" -pathType container)) {
|
||||||
throw "/etc directory at 📂$path doesn't exist (yet)"
|
throw "No /etc directory at 📂$path"
|
||||||
}
|
}
|
||||||
Set-Location "$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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-fonts
|
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.
|
This PowerShell script changes the working directory to the fonts folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-fonts
|
PS> ./cd-fonts
|
||||||
📂C:\Windows\Fonts
|
📂C:\Windows\Fonts (has 2 file and 3 subfolders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -49,15 +49,17 @@ Script Content
|
|||||||
try {
|
try {
|
||||||
$path = [Environment]::GetFolderPath('Fonts')
|
$path = [Environment]::GetFolderPath('Fonts')
|
||||||
if (-not(Test-Path "$path" -pathType container)) {
|
if (-not(Test-Path "$path" -pathType container)) {
|
||||||
throw "Fonts folder at 📂$path doesn't exist (yet)"
|
throw "No fonts folder at 📂$path"
|
||||||
}
|
}
|
||||||
Set-Location "$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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-home.ps1
|
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.
|
This PowerShell script changes the working directory to the user's home directory.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-home.ps1
|
PS> ./cd-home.ps1
|
||||||
📂C:\Users\Markus
|
📂C:\Users\Markus entered (has 4 files and 7 subfolders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -47,15 +47,17 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (-not(Test-Path "~" -pathType container)) { throw "No home directory at $path" }
|
||||||
$path = Resolve-Path "~"
|
$path = Resolve-Path "~"
|
||||||
if (-not(Test-Path "$path" -pathType container)) { throw "Home folder at $path doesn't exist (yet)" }
|
|
||||||
Set-Location "$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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-jenkins
|
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.
|
This PowerShell script changes the working directory to the Jenkins home directory.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-jenkins
|
PS> ./cd-jenkins
|
||||||
📂C:\Users\Markus\.jenkins
|
📂C:\Users\Markus\.jenkins entered (has 2 files and 21 folders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -55,7 +55,9 @@ try {
|
|||||||
throw "No Jenkins home directory found - is Jenkins installed?"
|
throw "No Jenkins home directory found - is Jenkins installed?"
|
||||||
}
|
}
|
||||||
Set-Location "$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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0])"
|
"⚠️ 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)*
|
||||||
|
@ -24,7 +24,7 @@ Script Content
|
|||||||
This PowerShell script changes the current working directory to the logs directory.
|
This PowerShell script changes the current working directory to the logs directory.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-logs
|
PS> ./cd-logs
|
||||||
📂/var/logs
|
📂/var/logs entered (has 3 files and 2 subfolders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -32,7 +32,7 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
function GetLogsDir {
|
function GetLogsDir {
|
||||||
if ($IsLinux) { return "/var/logs" }
|
if ($IsLinux -or $IsMacOS) { return "/var/logs" }
|
||||||
$WinDir = [System.Environment]::GetFolderPath('Windows')
|
$WinDir = [System.Environment]::GetFolderPath('Windows')
|
||||||
return "$WinDir\Logs"
|
return "$WinDir\Logs"
|
||||||
}
|
}
|
||||||
@ -40,12 +40,14 @@ function GetLogsDir {
|
|||||||
try {
|
try {
|
||||||
$path = GetLogsDir
|
$path = GetLogsDir
|
||||||
Set-Location "$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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-music
|
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.
|
This PowerShell script changes the working directory to the user's music folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-music
|
PS> ./cd-music
|
||||||
📂C:\Users\Markus\Music
|
📂C:\Users\Markus\Music entered (has 0 files and 3 subfolders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -52,16 +52,18 @@ try {
|
|||||||
} else {
|
} else {
|
||||||
$path = [Environment]::GetFolderPath('MyMusic')
|
$path = [Environment]::GetFolderPath('MyMusic')
|
||||||
}
|
}
|
||||||
if (Test-Path "$path" -pathType container) {
|
if (-not(Test-Path "$path" -pathType container)) {
|
||||||
Set-Location "$path"
|
throw "No music folder at 📂$path"
|
||||||
"📂$path"
|
|
||||||
exit 0 # success
|
|
||||||
}
|
}
|
||||||
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 {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
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)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-nextcloud
|
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.
|
This PowerShell script changes the working directory to the user's NextCloud folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-nextcloud
|
PS> ./cd-nextcloud
|
||||||
📂C:\Users\Markus\NextCloud
|
📂C:\Users\Markus\NextCloud entered (has 2 files and 3 subfolders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -48,9 +48,13 @@ Script Content
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$path = Resolve-Path "~/NextCloud"
|
$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"
|
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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0])"
|
"⚠️ 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)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-onedrive
|
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.
|
This PowerShell script changes the working directory to the user's OneDrive folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-onedrive
|
PS> ./cd-onedrive
|
||||||
📂C:\Users\Markus\OneDrive
|
📂C:\Users\Markus\OneDrive entered (has 2 files and 3 subfolders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -48,9 +48,13 @@ Script Content
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$path = Resolve-Path "~/OneDrive"
|
$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"
|
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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0])"
|
"⚠️ 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)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-pics
|
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.
|
This PowerShell script changes the working directory to the user's pictures folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-pics
|
PS> ./cd-pics
|
||||||
📂C:\Users\Markus\Pictures
|
📂C:\Users\Markus\Pictures entered (has 7 files and 0 subfolders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -52,14 +52,18 @@ try {
|
|||||||
} else {
|
} else {
|
||||||
$path = [Environment]::GetFolderPath('MyPictures')
|
$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"
|
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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-public
|
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.
|
This PowerShell script changes the working directory to the Public folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-public
|
PS> ./cd-public
|
||||||
📂C:\Users\Public
|
📂C:\Users\Public entered (has 2 files and 3 subfolders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -52,14 +52,18 @@ try {
|
|||||||
} else {
|
} else {
|
||||||
$path = Resolve-Path "~/../Public"
|
$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"
|
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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-recent
|
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.
|
This PowerShell script changes the working directory to the 'recent' folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-recent
|
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
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -49,10 +49,12 @@ Script Content
|
|||||||
try {
|
try {
|
||||||
$path = [Environment]::GetFolderPath('Recent')
|
$path = [Environment]::GetFolderPath('Recent')
|
||||||
if (-not(Test-Path "$path" -pathType container)) {
|
if (-not(Test-Path "$path" -pathType container)) {
|
||||||
throw "Recent folder at 📂$path doesn't exist (yet)"
|
throw "No recent folder at $path"
|
||||||
}
|
}
|
||||||
Set-Location "$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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ 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)*
|
||||||
|
@ -24,7 +24,7 @@ Script Content
|
|||||||
This PowerShell script changes the working directory to the user's recycle bin folder.
|
This PowerShell script changes the working directory to the user's recycle bin folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-recycle-bin
|
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
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -43,14 +43,18 @@ try {
|
|||||||
} else {
|
} else {
|
||||||
$path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)"
|
$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"
|
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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value
|
Default value
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
@ -26,7 +27,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-repo.ps1 rust
|
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
|
Specifies the folder name of the Git repository
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-repo.ps1 rust
|
PS> ./cd-repo.ps1 rust
|
||||||
📂C:\Repos\rust · on branch: ## main ... origin/main
|
📂C:\Repos\rust entered, current branch is: ## main ... origin/main
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -60,36 +61,28 @@ Script Content
|
|||||||
param([string]$folderName = "")
|
param([string]$folderName = "")
|
||||||
|
|
||||||
try {
|
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
|
if (Test-Path "~/Repos" -pathType container) { $path = "~/Repos"
|
||||||
$path = "~/Repos"
|
} elseif (Test-Path "~/repos" -pathType container) { $path = "~/repos"
|
||||||
} elseif (Test-Path "~/repos" -pathType Container) {
|
} elseif (Test-Path "~/Repositories" -pathType container) { $path = "~/Repositories"
|
||||||
$path = "~/repos"
|
} elseif (Test-Path "~/repositories" -pathType container) { $path = "~/repositories"
|
||||||
} elseif (Test-Path "~/Repositories" -pathType Container) { # try long name
|
} elseif (Test-Path "/Repos" -pathType container) { $path = "/Repos"
|
||||||
$path = "~/Repositories"
|
} elseif (Test-Path "/repos" -pathType container) { $path = "/repos"
|
||||||
} elseif (Test-Path "~/repositories" -pathType Container) {
|
} elseif (Test-Path "/Repositories" -pathType container) { $path = "/Repositories"
|
||||||
$path = "~/repositories"
|
} elseif (Test-Path "/repositories" -pathType container) { $path = "/repositories"
|
||||||
} elseif (Test-Path "/Repos" -pathType Container) { # try short name in root dir
|
} elseif (Test-Path "~/source/repos" -pathType container) { $path = "~/source/repos" # Visual Studio default
|
||||||
$path = "/Repos"
|
} elseif (Test-Path "D:/Repos" -pathType container) { $path = "D:/Repos" # second HDD
|
||||||
} 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"
|
|
||||||
} else {
|
} else {
|
||||||
throw "No Git repositories folder in your home directory or in the root folder yet"
|
throw "No Git repositories folder in your home directory or in the root folder yet"
|
||||||
}
|
}
|
||||||
$path += "/" + $folderName
|
$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"
|
$path = Resolve-Path "$path"
|
||||||
Set-Location "$path"
|
Set-Location "$path"
|
||||||
Write-Host "📂$path · on branch: " -noNewline
|
Write-Host "📂$path entered, current branch is: " -noNewline
|
||||||
& git status --short --branch --show-stash
|
& git status --branch --short
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0])"
|
"⚠️ 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)*
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
The *cd-repos.ps1* Script
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-repos.ps1
|
PS> ./cd-repos.ps1
|
||||||
📂C:\Repos
|
📂C:\Repos (has 33 subfolders)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -34,14 +34,12 @@ Script Content
|
|||||||
```powershell
|
```powershell
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Sets the working directory to the Git repos folder
|
Sets the working dir to the repos folder
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
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.
|
||||||
.PARAMETER subpath
|
|
||||||
Specifies an additional relative subpath (optional)
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-repos.ps1
|
PS> ./cd-repos.ps1
|
||||||
📂C:\Repos
|
📂C:\Repos (has 33 subfolders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -49,30 +47,23 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (Test-Path "~/Repos" -pathType Container) { # try short name in home dir
|
if (Test-Path "~/Repos" -pathType container) { $path = "~/Repos"
|
||||||
$path = "~/Repos"
|
} elseif (Test-Path "~/repos" -pathType container) { $path = "~/repos"
|
||||||
} elseif (Test-Path "~/repos" -pathType Container) {
|
} elseif (Test-Path "~/Repositories" -pathType container) { $path = "~/Repositories"
|
||||||
$path = "~/repos"
|
} elseif (Test-Path "~/repositories" -pathType container) { $path = "~/repositories"
|
||||||
} elseif (Test-Path "~/Repositories" -pathType Container) { # try long name
|
} elseif (Test-Path "/Repos" -pathType container) { $path = "/Repos"
|
||||||
$path = "~/Repositories"
|
} elseif (Test-Path "/repos" -pathType container) { $path = "/repos"
|
||||||
} elseif (Test-Path "~/repositories" -pathType Container) {
|
} elseif (Test-Path "/Repositories" -pathType container) { $path = "/Repositories"
|
||||||
$path = "~/repositories"
|
} elseif (Test-Path "/repositories" -pathType container) { $path = "/repositories"
|
||||||
} elseif (Test-Path "/Repos" -pathType Container) { # try short name in root dir
|
} elseif (Test-Path "~/source/repos" -pathType container) { $path = "~/source/repos" # Visual Studio default
|
||||||
$path = "/Repos"
|
} elseif (Test-Path "D:/Repos" -pathType container) { $path = "D:/Repos" # second HDD
|
||||||
} 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"
|
|
||||||
} else {
|
} 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
|
$path = Resolve-Path $path
|
||||||
Set-Location "$path"
|
Set-Location "$path"
|
||||||
"📂$path"
|
$subfolders = Get-ChildItem $path -attributes Directory
|
||||||
|
"📂$path entered (has $($subfolders.Count) subfolders)"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0])"
|
"⚠️ 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)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-root
|
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).
|
This PowerShell script changes the current working directory to the root directory (C:\ on Windows).
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-root
|
PS> ./cd-root
|
||||||
📂C:\
|
📂C:\ entered (has 0 files and 7 folders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -49,12 +49,14 @@ Script Content
|
|||||||
try {
|
try {
|
||||||
if ($IsLinux) { $path = "/" } else { $path = "C:\" }
|
if ($IsLinux) { $path = "/" } else { $path = "C:\" }
|
||||||
Set-Location "$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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -24,7 +24,7 @@ Script Content
|
|||||||
This PowerShell script changes the working directory to the user's screenshots folder.
|
This PowerShell script changes the working directory to the user's screenshots folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-screenshots
|
PS> ./cd-screenshots
|
||||||
📂C:\Users\Markus\Pictures\Screenshots
|
📂C:\Users\Markus\Pictures\Screenshots (has 7 files and 0 folders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -47,12 +47,14 @@ function GetScreenshotsFolder {
|
|||||||
try {
|
try {
|
||||||
$path = GetScreenshotsFolder
|
$path = GetScreenshotsFolder
|
||||||
Set-Location "$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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-scripts.ps1
|
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.
|
This PowerShell script changes the working directory to the PowerShell scripts folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-scripts.ps1
|
PS> ./cd-scripts.ps1
|
||||||
📂C:\Repos\PowerShell\scripts
|
📂C:\Repos\PowerShell\scripts entered (has 645 scripts)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -48,14 +48,17 @@ Script Content
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$path = Resolve-Path "$PSScriptRoot"
|
$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"
|
Set-Location "$path"
|
||||||
"📂$path"
|
$files = Get-ChildItem $path -attributes !Directory
|
||||||
|
"📂$path entered (has $($files.Count) scripts)"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-ssh.ps1
|
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.
|
This PowerShell script changes the working directory to the user's secure shell (SSH) folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-ssh.ps1
|
PS> ./cd-ssh.ps1
|
||||||
📂C:\Users\Markus\.ssh
|
📂C:\Users\Markus\.ssh entered (has 4 files)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -48,10 +48,13 @@ Script Content
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$path = "~/.ssh"
|
$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"
|
$path = Resolve-Path "$path"
|
||||||
Set-Location "$path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
$files = Get-ChildItem $path -attributes !Directory
|
||||||
|
"📂$path entered (has $($files.Count) files)"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0])"
|
"⚠️ 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)*
|
||||||
|
@ -24,7 +24,7 @@ Script Content
|
|||||||
This PowerShell script changes the working directory to the temporary folder.
|
This PowerShell script changes the working directory to the temporary folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-temp
|
PS> ./cd-temp
|
||||||
📂C:\Users\Markus\AppData\Local\Temp
|
📂C:\Users\Markus\AppData\Local\Temp (has 2 files and 3 subfolders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -40,14 +40,18 @@ function GetTempDir {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$path = GetTempDir
|
$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"
|
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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-templates
|
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.
|
This PowerShell script changes the working directory to the templates folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-templates
|
PS> ./cd-templates
|
||||||
📂/home/Markus/Templates
|
📂/home/Markus/Templates entered (has 3 files and 0 subfolders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -52,14 +52,18 @@ try {
|
|||||||
} else {
|
} else {
|
||||||
$path = [Environment]::GetFolderPath('Templates')
|
$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"
|
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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -24,7 +24,7 @@ Script Content
|
|||||||
This PowerShell script changes the working directory to the user's trash folder.
|
This PowerShell script changes the working directory to the user's trash folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-trash
|
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
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -43,14 +43,18 @@ try {
|
|||||||
} else {
|
} else {
|
||||||
$path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)"
|
$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"
|
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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-users
|
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.
|
This PowerShell script changes the working directory to the users directory.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-users
|
PS> ./cd-users
|
||||||
📂C:\Users
|
📂C:\Users entered (has 0 files and 4 subfolders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -48,14 +48,18 @@ Script Content
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$path = Resolve-Path "~/.."
|
$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"
|
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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-videos
|
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.
|
This PowerShell script changes the working directory to the user's videos folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-videos
|
PS> ./cd-videos
|
||||||
📂C:\Users\Markus\Videos
|
📂C:\Users\Markus\Videos entered (has 3 files and 0 subfolders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -52,14 +52,18 @@ try {
|
|||||||
} else {
|
} else {
|
||||||
$path = [Environment]::GetFolderPath('MyVideos')
|
$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"
|
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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-windows
|
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.
|
This PowerShell script changes the working directory to the Windows directory.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-windows
|
PS> ./cd-windows
|
||||||
📂C:\Windows
|
📂C:\Windows entered (has 7 files and 42 subfolders)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -48,14 +48,18 @@ Script Content
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$path = Resolve-Path "$env:WINDIR"
|
$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"
|
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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value
|
Default value
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
@ -69,7 +70,7 @@ try {
|
|||||||
|
|
||||||
$Path = "$(GetTempDir)/next_wallpaper.jpg"
|
$Path = "$(GetTempDir)/next_wallpaper.jpg"
|
||||||
& wget -O $Path "https://source.unsplash.com/3840x2160?$Category"
|
& 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"
|
& "$PSScriptRoot/set-wallpaper.ps1" -ImageFile "$Path"
|
||||||
exit 0 # success
|
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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value "$HOME\my.credentials"
|
Default value "$HOME\my.credentials"
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value
|
Default value
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
-minLevel <Int64>
|
-minLevel <Int64>
|
||||||
@ -24,6 +25,7 @@ Parameters
|
|||||||
Position? 2
|
Position? 2
|
||||||
Default value 10000000
|
Default value 10000000
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value 5368709120
|
Default value 5368709120
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value
|
Default value
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value
|
Default value
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
@ -170,4 +171,4 @@ function Check-Header { param( $path )
|
|||||||
Check-Header $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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -28,7 +28,7 @@ Script Content
|
|||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz, Tyler MacInnis | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Bytes2String { param([int64]$Bytes)
|
function Bytes2String { param([int64]$Bytes)
|
||||||
@ -48,15 +48,17 @@ try {
|
|||||||
# TODO
|
# TODO
|
||||||
} else {
|
} else {
|
||||||
$Details = Get-WmiObject Win32_VideoController
|
$Details = Get-WmiObject Win32_VideoController
|
||||||
$Model = $Details.Caption
|
foreach ($GPU in $Details) {
|
||||||
$RAMSize = $Details.AdapterRAM
|
$Model = $GPU.Caption
|
||||||
$ResWidth = $Details.CurrentHorizontalResolution
|
$RAMSize = $GPU.AdapterRAM
|
||||||
$ResHeight = $Details.CurrentVerticalResolution
|
$ResWidth = $GPU.CurrentHorizontalResolution
|
||||||
$BitsPerPixel = $Details.CurrentBitsPerPixel
|
$ResHeight = $GPU.CurrentVerticalResolution
|
||||||
$RefreshRate = $Details.CurrentRefreshRate
|
$BitsPerPixel = $GPU.CurrentBitsPerPixel
|
||||||
$DriverVersion = $Details.DriverVersion
|
$RefreshRate = $GPU.CurrentRefreshRate
|
||||||
$Status = $Details.Status
|
$DriverVersion = $GPU.DriverVersion
|
||||||
Write-Host "✅ $Model GPU ($(Bytes2String $RAMSize) RAM, $($ResWidth)x$($ResHeight) pixels, $($BitsPerPixel)-bit, $($RefreshRate)Hz, driver $DriverVersion) - status $Status"
|
$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
|
exit 0 # success
|
||||||
} catch {
|
} 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)*
|
||||||
|
@ -64,4 +64,4 @@ Write-Host "`n === H A R D W A R E ===" -foregroundColor green
|
|||||||
exit 0 # success
|
exit 0 # success
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||||
|
@ -58,4 +58,4 @@ Script Content
|
|||||||
exit 0 # success
|
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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value
|
Default value
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value
|
Default value
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -16,6 +16,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value
|
Default value
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -67,4 +67,4 @@ Write-Host "`n === N E T W O R K ===" -foregroundColor green
|
|||||||
exit 0 # success
|
exit 0 # success
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||||
|
@ -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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -14,6 +14,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value
|
Default value
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<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)*
|
||||||
|
@ -24,7 +24,7 @@ Script Content
|
|||||||
This PowerShell script queries pending operating system reboots and prints it.
|
This PowerShell script queries pending operating system reboots and prints it.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
./check-pending-reboot.ps1
|
./check-pending-reboot.ps1
|
||||||
✅ No pending reboot
|
✅ No pending reboot.
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -41,7 +41,7 @@ function Test-RegistryValue { param([parameter(Mandatory=$true)][ValidateNotNull
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$reply = "✅ No pending reboot"
|
[string]$reply = "✅ No pending reboot."
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
if (Test-Path "/var/run/reboot-required") {
|
if (Test-Path "/var/run/reboot-required") {
|
||||||
$reply = "⚠️ Pending reboot (found: /var/run/reboot-required)"
|
$reply = "⚠️ Pending reboot (found: /var/run/reboot-required)"
|
||||||
@ -79,7 +79,7 @@ try {
|
|||||||
$reason += ", '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'"
|
$reason += ", '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'"
|
||||||
}
|
}
|
||||||
if ($reason -ne "") {
|
if ($reason -ne "") {
|
||||||
$reply = "⚠️ Pending reboot (registry got $($reason.substring(2)))"
|
$reply = "⚠️ Pending reboot (found: $($reason.substring(2)) in registry)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Write-Host $reply
|
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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -60,10 +60,10 @@ try {
|
|||||||
if ($details.PowerLineStatus -eq "Online") {
|
if ($details.PowerLineStatus -eq "Online") {
|
||||||
if ($details.BatteryChargeStatus -eq "NoSystemBattery") {
|
if ($details.BatteryChargeStatus -eq "NoSystemBattery") {
|
||||||
$reply = "✅ AC powered"
|
$reply = "✅ AC powered"
|
||||||
} elseif ($percent -ge 95) {
|
} elseif ($percent -ge 90) {
|
||||||
$reply = "✅ Battery full ($percent%, power scheme is '$powerScheme')"
|
$reply = "✅ Battery $percent% full (power scheme is '$powerScheme')"
|
||||||
} else {
|
} else {
|
||||||
$reply = "✅ Battery charging ($percent%, power scheme is '$powerScheme')"
|
$reply = "✅ Battery $percent% and charging (power scheme is '$powerScheme')"
|
||||||
}
|
}
|
||||||
} else { # must be offline
|
} else { # must be offline
|
||||||
if (($remaining -eq 0) -and ($percent -ge 60)) {
|
if (($remaining -eq 0) -and ($percent -ge 60)) {
|
||||||
@ -77,7 +77,7 @@ try {
|
|||||||
} elseif ($percent -lt 10) {
|
} elseif ($percent -lt 10) {
|
||||||
$reply = "⚠️ Battery $percent% only with $($remaining)min remaining (power scheme is '$powerScheme') "
|
$reply = "⚠️ Battery $percent% only with $($remaining)min remaining (power scheme is '$powerScheme') "
|
||||||
} elseif ($percent -ge 90) {
|
} 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 {
|
} else {
|
||||||
$reply = "✅ Battery $percent% with $($remaining)min remaining (power scheme is '$powerScheme') "
|
$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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value
|
Default value
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value "$PWD"
|
Default value "$PWD"
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
@ -78,7 +79,7 @@ try {
|
|||||||
|
|
||||||
Write-Host "⏳ (1/10) Searching for Git executable... " -noNewline
|
Write-Host "⏳ (1/10) Searching for Git executable... " -noNewline
|
||||||
& git --version
|
& git --version
|
||||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||||
|
|
||||||
Write-Host "⏳ (2/10) Checking local repository... " -noNewline
|
Write-Host "⏳ (2/10) Checking local repository... " -noNewline
|
||||||
$FullPath = Resolve-Path "$pathToRepo"
|
$FullPath = Resolve-Path "$pathToRepo"
|
||||||
@ -87,15 +88,15 @@ try {
|
|||||||
|
|
||||||
Write-Host "⏳ (3/10) Querying remote URL... " -noNewline
|
Write-Host "⏳ (3/10) Querying remote URL... " -noNewline
|
||||||
& git -C "$FullPath" remote get-url origin
|
& 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
|
Write-Host "⏳ (4/10) Querying current branch... " -noNewline
|
||||||
& git -C "$FullPath" branch --show-current
|
& 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
|
Write-Host "⏳ (5/10) Fetching remote updates... " -noNewline
|
||||||
& git -C "$FullPath" fetch --all --recurse-submodules --tags --force --quiet
|
& 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 "OK"
|
||||||
|
|
||||||
Write-Host "⏳ (6/10) Querying latest tag... " -noNewline
|
Write-Host "⏳ (6/10) Querying latest tag... " -noNewline
|
||||||
@ -105,19 +106,19 @@ try {
|
|||||||
|
|
||||||
Write-Host "⏳ (7/10) Verifying data integrity..."
|
Write-Host "⏳ (7/10) Verifying data integrity..."
|
||||||
& git -C "$FullPath" fsck
|
& 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..."
|
Write-Host "⏳ (8/10) Running maintenance tasks..."
|
||||||
& git -C "$FullPath" maintenance run
|
& 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..."
|
Write-Host "⏳ (9/10) Checking submodule status..."
|
||||||
& git -C "$FullPath" 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
|
Write-Host "⏳ (10/10) Checking repo status... " -noNewline
|
||||||
& git -C "$FullPath" status
|
& 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
|
$repoDirName = (Get-Item "$FullPath").Name
|
||||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
[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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value "$PWD"
|
Default value "$PWD"
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -49,7 +49,7 @@ function Bytes2String([int64]$bytes) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = (smartctl --version)
|
$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) {
|
if ($IsLinux) {
|
||||||
$devices = $(sudo smartctl --scan-open)
|
$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)*
|
||||||
|
@ -64,4 +64,4 @@ Write-Host "`n === S O F T W A R E ===" -foregroundColor green
|
|||||||
exit 0 # success
|
exit 0 # success
|
||||||
```
|
```
|
||||||
|
|
||||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
|
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value
|
Default value
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value 10
|
Default value 10
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
@ -89,16 +90,16 @@ try {
|
|||||||
[int64]$free = ($total - $used)
|
[int64]$free = ($total - $used)
|
||||||
}
|
}
|
||||||
if ($total -eq 0) {
|
if ($total -eq 0) {
|
||||||
Write-Output "⚠️ No swap space configured"
|
Write-Output "⚠️ No swap space configured."
|
||||||
} elseif ($free -eq 0) {
|
} 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) {
|
} elseif ($free -lt $minLevel) {
|
||||||
Write-Output "⚠️ Swap space has only $(MB2String $free) of $(MB2String $total) left!"
|
Write-Output "⚠️ Swap space has only $(MB2String $free) of $(MB2String $total) left!"
|
||||||
} elseif ($used -lt 3) {
|
} elseif ($used -lt 3) {
|
||||||
Write-Output "✅ Swap space has $(MB2String $total) reserved"
|
Write-Output "✅ Swap space has $(MB2String $total) reserved."
|
||||||
} else {
|
} else {
|
||||||
[int64]$percent = ($used * 100) / $total
|
[int64]$percent = ($used * 100) / $total
|
||||||
Write-Output "✅ Swap space uses $(MB2String $used) ($percent%) of $(MB2String $total)"
|
Write-Output "✅ Swap space at $(MB2String $used) ($percent%) of $(MB2String $total)."
|
||||||
}
|
}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} 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)*
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
The *check-symlinks.ps1* Script
|
The *check-symlinks.ps1* Script
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
This PowerShell script checks every symbolic link in a folder (including subfolders).
|
This PowerShell script checks all symbolic links in a directory tree. It returns the number of broken symlinks as exit value.
|
||||||
It returns the number of broken symlinks as exit value.
|
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
@ -16,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value
|
Default value
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
@ -26,9 +26,9 @@ Parameters
|
|||||||
Example
|
Example
|
||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-symlinks C:\Users
|
PS> ./check-symlinks D:\
|
||||||
⏳ Checking symlinks at 📂C:\Users including subfolders...
|
⏳ Please wait while checking symlinks at: 📂D:\ ...
|
||||||
✅ Found 0 broken symlinks at 📂C:\Users in 60 sec
|
✅ Found 0 broken symlinks at 📂D:\ in 60s.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -45,16 +45,15 @@ Script Content
|
|||||||
```powershell
|
```powershell
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Checks symlinks in a folder
|
Checks all symlinks in a folder
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script checks every symbolic link in a folder (including subfolders).
|
This PowerShell script checks all symbolic links in a directory tree. It returns the number of broken symlinks as exit value.
|
||||||
It returns the number of broken symlinks as exit value.
|
|
||||||
.PARAMETER folder
|
.PARAMETER folder
|
||||||
Specifies the path to the folder
|
Specifies the path to the folder
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-symlinks C:\Users
|
PS> ./check-symlinks D:\
|
||||||
⏳ Checking symlinks at 📂C:\Users including subfolders...
|
⏳ Please wait while checking symlinks at: 📂D:\ ...
|
||||||
✅ Found 0 broken symlinks at 📂C:\Users in 60 sec
|
✅ Found 0 broken symlinks at 📂D:\ in 60s.
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -64,40 +63,40 @@ Script Content
|
|||||||
param([string]$Folder = "")
|
param([string]$Folder = "")
|
||||||
|
|
||||||
try {
|
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()
|
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
$FullPath = Resolve-Path "$Folder"
|
$fullPath = Resolve-Path "$Folder"
|
||||||
"⏳ Checking symlinks at 📂$FullPath including subfolders..."
|
"⏳ Please wait while checking symlinks at 📂$fullPath ..."
|
||||||
|
|
||||||
[int]$NumTotal = [int]$NumBroken = 0
|
[int]$numTotal = [int]$numBroken = 0
|
||||||
Get-ChildItem $FullPath -recurse | Where { $_.Attributes -match "ReparsePoint" } | ForEach-Object {
|
Get-ChildItem $fullPath -recurse | Where { $_.Attributes -match "ReparsePoint" } | ForEach-Object {
|
||||||
$Symlink = $_.FullName
|
$Symlink = $_.FullName
|
||||||
$Target = ($_ | Select-Object -ExpandProperty Target -ErrorAction Ignore)
|
$Target = ($_ | Select-Object -ExpandProperty Target -ErrorAction Ignore)
|
||||||
if ($Target) {
|
if ($Target) {
|
||||||
$path = $_.FullName + "\..\" + ($_ | Select-Object -ExpandProperty Target)
|
$path = $_.FullName + "\..\" + ($_ | Select-Object -ExpandProperty Target)
|
||||||
$item = Get-Item $path -ErrorAction Ignore
|
$item = Get-Item $path -ErrorAction Ignore
|
||||||
if (!$item) {
|
if (!$item) {
|
||||||
$NumBroken++
|
$numBroken++
|
||||||
"Symlink $Symlink to: $Target seems broken (#$NumBroken)"
|
"Broken symlink #$($numBroken) at $Symlink linking to: $Target"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$NumTotal++
|
$numTotal++
|
||||||
}
|
}
|
||||||
|
|
||||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||||
if ($NumTotal -eq 0) {
|
if ($numTotal -eq 0) {
|
||||||
"✅ No symlink found at 📂$FullPath in $Elapsed sec"
|
"✅ No symlink found at 📂$fullPath in $($elapsed)s."
|
||||||
} elseif ($NumBroken -eq 1) {
|
} elseif ($numBroken -eq 1) {
|
||||||
"✅ Found $NumBroken broken symlink at 📂$FullPath in $Elapsed sec"
|
"✅ Found $numBroken broken symlink at 📂$fullPath in $($elapsed)s ($numTotal symlinks in total)."
|
||||||
} else {
|
} 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 {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
exit 1
|
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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value
|
Default value
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value
|
Default value
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<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)*
|
||||||
|
@ -50,7 +50,7 @@ Script Content
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
sfc /verifyOnly
|
sfc /verifyOnly
|
||||||
if ($lastExitCode -ne "0") { throw "'sfc /verifyOnly' failed" }
|
if ($lastExitCode -ne 0) { throw "'sfc /verifyOnly' failed" }
|
||||||
|
|
||||||
"✅ checked Windows system files"
|
"✅ checked Windows system files"
|
||||||
exit 0 # success
|
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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value
|
Default value
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
@ -26,7 +27,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-xml-file.ps1 myfile.xml
|
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
|
Specifies the path to the XML file
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-xml-file.ps1 myfile.xml
|
PS> ./check-xml-file.ps1 myfile.xml
|
||||||
✅ Valid XML in 📄myfile.xml
|
✅ myfile.xml is valid XML
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -77,7 +78,7 @@ try {
|
|||||||
|
|
||||||
if ($script:ErrorCount -gt 0) { throw "Invalid XML" }
|
if ($script:ErrorCount -gt 0) { throw "Invalid XML" }
|
||||||
|
|
||||||
"✅ Valid XML in 📄$path"
|
"✅ $path is valid XML"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ $($Error[0]) in 📄$path"
|
"⚠️ $($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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value "$PWD"
|
Default value "$PWD"
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<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)*
|
||||||
|
@ -16,6 +16,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value "$PWD"
|
Default value "$PWD"
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
@ -27,11 +28,11 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./clean-repo.ps1 C:\Repos\rust
|
PS> ./clean-repo.ps1 C:\Repos\rust
|
||||||
⏳ (1/4) Searching for Git executable... git version 2.45.0
|
⏳ (1/4) Searching for Git executable... git version 2.47.0
|
||||||
⏳ (2/4) Checking local repository... C:\Repos\rust
|
⏳ (2/4) Checking local repository... C:\Repos\rust
|
||||||
⏳ (3/4) Removing untracked files in repository...
|
⏳ (3/4) Removing untracked files in repository...
|
||||||
⏳ (4/4) Removing untracked files in submodules...
|
⏳ (4/4) Removing untracked files in submodules...
|
||||||
✅ 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)
|
Specifies the file path to the local Git repository (current working directory by default)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./clean-repo.ps1 C:\Repos\rust
|
PS> ./clean-repo.ps1 C:\Repos\rust
|
||||||
⏳ (1/4) Searching for Git executable... git version 2.45.0
|
⏳ (1/4) Searching for Git executable... git version 2.47.0
|
||||||
⏳ (2/4) Checking local repository... C:\Repos\rust
|
⏳ (2/4) Checking local repository... C:\Repos\rust
|
||||||
⏳ (3/4) Removing untracked files in repository...
|
⏳ (3/4) Removing untracked files in repository...
|
||||||
⏳ (4/4) Removing untracked files in submodules...
|
⏳ (4/4) Removing untracked files in submodules...
|
||||||
✅ Cleaned up repo 📂rust in 2s.
|
✅ Repo 📂rust is clean now.
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -70,11 +71,9 @@ Script Content
|
|||||||
param([string]$path = "$PWD")
|
param([string]$path = "$PWD")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
|
||||||
|
|
||||||
Write-Host "⏳ (1/4) Searching for Git executable... " -noNewline
|
Write-Host "⏳ (1/4) Searching for Git executable... " -noNewline
|
||||||
& git --version
|
& git --version
|
||||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||||
|
|
||||||
"⏳ (2/4) Checking local repository... $path"
|
"⏳ (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?" }
|
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..."
|
"⏳ (3/4) Removing untracked files in repository..."
|
||||||
& git -C "$path" clean -xfd -f # to delete all untracked files in the main repo
|
& 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..."
|
Write-Warning "'git clean' failed with exit code $lastExitCode, retrying once..."
|
||||||
& git -C "$path" clean -xfd -f
|
& 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..."
|
"⏳ (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
|
& 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
|
"✅ Repo 📂$repoName is clean now."
|
||||||
"✅ Cleaned up repo 📂$repoName in $($elapsed)s."
|
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value "$PWD"
|
Default value "$PWD"
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
@ -26,7 +27,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./clean-repos.ps1 C:\MyRepos
|
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
|
⏳ (2) Checking parent folder 📂Repos... 28 subfolders found
|
||||||
⏳ (3/30) Cleaning 📂base256unicode...
|
⏳ (3/30) Cleaning 📂base256unicode...
|
||||||
...
|
...
|
||||||
@ -53,7 +54,7 @@ Script Content
|
|||||||
Specifies the path to the parent folder (current working dir by default)
|
Specifies the path to the parent folder (current working dir by default)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./clean-repos.ps1 C:\MyRepos
|
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
|
⏳ (2) Checking parent folder 📂Repos... 28 subfolders found
|
||||||
⏳ (3/30) Cleaning 📂base256unicode...
|
⏳ (3/30) Cleaning 📂base256unicode...
|
||||||
...
|
...
|
||||||
@ -70,7 +71,7 @@ try {
|
|||||||
|
|
||||||
Write-Host "⏳ (1) Searching for Git executable... " -noNewline
|
Write-Host "⏳ (1) Searching for Git executable... " -noNewline
|
||||||
& git --version
|
& git --version
|
||||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||||
|
|
||||||
$parentDirName = (Get-Item "$ParentDir").Name
|
$parentDirName = (Get-Item "$ParentDir").Name
|
||||||
Write-Host "⏳ (2) Checking parent folder 📂$parentDirName... " -noNewline
|
Write-Host "⏳ (2) Checking parent folder 📂$parentDirName... " -noNewline
|
||||||
@ -86,13 +87,13 @@ try {
|
|||||||
"⏳ ($Step/$($numFolders + 2)) Cleaning 📂$FolderName..."
|
"⏳ ($Step/$($numFolders + 2)) Cleaning 📂$FolderName..."
|
||||||
|
|
||||||
& git -C "$folder" clean -xfd -f # force + recurse into dirs + don't use the standard ignore rules
|
& 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
|
& 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
|
[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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ 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)*
|
||||||
|
@ -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)*
|
||||||
|
@ -48,7 +48,7 @@ Script Content
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Clear-RecycleBin -Confirm:$false
|
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."
|
& "$PSScriptRoot/speak-english.ps1" "It's clean now."
|
||||||
exit 0 # success
|
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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value "$PWD"
|
Default value "$PWD"
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
@ -29,7 +30,7 @@ PS> ./clone-repos C:\MyRepos
|
|||||||
⏳ (1) Searching for Git executable... git version 2.46.0.windows.1
|
⏳ (1) Searching for Git executable... git version 2.46.0.windows.1
|
||||||
⏳ (2) Reading data/popular-repos.csv... 29 repos
|
⏳ (2) Reading data/popular-repos.csv... 29 repos
|
||||||
⏳ (3) Checking target folder... 📂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
|
⏳ (1) Searching for Git executable... git version 2.46.0.windows.1
|
||||||
⏳ (2) Reading data/popular-repos.csv... 29 repos
|
⏳ (2) Reading data/popular-repos.csv... 29 repos
|
||||||
⏳ (3) Checking target folder... 📂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
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
@ -72,7 +73,7 @@ try {
|
|||||||
|
|
||||||
Write-Host "⏳ (1) Searching for Git executable... " -noNewline
|
Write-Host "⏳ (1) Searching for Git executable... " -noNewline
|
||||||
& git --version
|
& git --version
|
||||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||||
|
|
||||||
Write-Host "⏳ (2) Reading data/popular-repos.csv... " -noNewline
|
Write-Host "⏳ (2) Reading data/popular-repos.csv... " -noNewline
|
||||||
$table = Import-CSV "$PSScriptRoot/../data/popular-repos.csv"
|
$table = Import-CSV "$PSScriptRoot/../data/popular-repos.csv"
|
||||||
@ -98,14 +99,14 @@ try {
|
|||||||
"⏳ ($step/$($total + 3)) Skipping 📂$folderName ($category): exists already"
|
"⏳ ($step/$($total + 3)) Skipping 📂$folderName ($category): exists already"
|
||||||
$skipped++
|
$skipped++
|
||||||
} elseif ($shallow -eq "yes") {
|
} 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"
|
& 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++
|
$cloned++
|
||||||
} else {
|
} else {
|
||||||
"⏳ ($step/$($total + 3)) Cloning 📂$folderName ($category) from $URL (full $branch branch)..."
|
"⏳ ($step/$($total + 3)) Cloning 📂$folderName ($category) from $URL (full $branch branch)..."
|
||||||
& git clone --branch "$branch" --recurse-submodules "$URL" "$targetDir/$folderName"
|
& 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++
|
$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)*
|
||||||
|
@ -15,6 +15,7 @@ Parameters
|
|||||||
Position? 1
|
Position? 1
|
||||||
Default value "$PWD"
|
Default value "$PWD"
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
|
Aliases
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<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)*
|
||||||
|
@ -48,4 +48,4 @@ Stop-Process -name "CalculatorApp"
|
|||||||
exit 0 # success
|
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
Loading…
x
Reference in New Issue
Block a user