Added list-automatic-variables.ps1

This commit is contained in:
Markus Fleschutz 2020-12-30 11:41:38 +00:00
parent 08698f889f
commit aa0d1ab290
4 changed files with 66 additions and 18 deletions

View File

@ -17,6 +17,7 @@ empty-dir.ps1, empties the given directory
enable-crash-dumps.ps1, enables the writing of crash dumps
inspect-exe.ps1, prints basic information of the given executable file
list-anagrams.ps1, lists all anagrams of the given word
list-automatic-variables.ps1, lists PowerShell automatic variables
list-empty-dirs.ps1, lists empty subfolders in a directory tree
list-files.ps1, lists all files in the given folder and also in every subfolder
list-installed-software.ps1, lists the installed software
@ -58,7 +59,6 @@ speak-text.ps1, speaks the given text by text-to-speech (TTS)
switch-shelly1.ps1, switches a Shelly1 device in the local network
take-screenshot.ps1, takes a single screenshot
take-screenshots.ps1, takes multiple screenshots
test.ps1, simple test script
train-dns-cache.ps1, trains the DNS cache with frequently used domain names
translate-file.ps1, translates the given file from source to target language
translate-text.ps1, translates the given text into other languages

1 Filename Description
17 enable-crash-dumps.ps1 enables the writing of crash dumps
18 inspect-exe.ps1 prints basic information of the given executable file
19 list-anagrams.ps1 lists all anagrams of the given word
20 list-automatic-variables.ps1 lists PowerShell automatic variables
21 list-empty-dirs.ps1 lists empty subfolders in a directory tree
22 list-files.ps1 lists all files in the given folder and also in every subfolder
23 list-installed-software.ps1 lists the installed software
59 switch-shelly1.ps1 switches a Shelly1 device in the local network
60 take-screenshot.ps1 takes a single screenshot
61 take-screenshots.ps1 takes multiple screenshots
test.ps1 simple test script
62 train-dns-cache.ps1 trains the DNS cache with frequently used domain names
63 translate-file.ps1 translates the given file from source to target language
64 translate-text.ps1 translates the given text into other languages

View File

@ -25,6 +25,7 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol
* [enable-crash-dumps.ps1](Scripts/enable-crash-dumps.ps1) - enables the writing of crash dumps
* [inspect-exe.ps1](Scripts/inspect-exe.ps1) - prints basic information of the given executable file
* [list-anagrams.ps1](Scripts/list-anagrams.ps1) - lists all anagrams of the given word
* [list-automatic-variables.ps1](Scripts/list-automatic-variables.ps1) - lists PowerShell automatic variables
* [list-empty-dirs.ps1](Scripts/list-empty-dirs.ps1) - lists empty subfolders in a directory tree
* [list-installed-software.ps1](Scripts/list-installed-software.ps1) - lists the installed software
* [list-files.ps1](Scripts/list-files.ps1) - lists all files in the given folder and also in every subfolder
@ -66,7 +67,6 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol
* [switch-shelly1.ps1](Scripts/switch-shelly1.ps1) - switches a Shelly1 device in the local network
* [take-screenshot.ps1](Scripts/take-screenshot.ps1) - takes a single screenshot
* [take-screenshots.ps1](Scripts/take-screenshots.ps1) - takes multiple screenshots
* [test.ps1](Scripts/test.ps1) - simple test script
* [train-dns-cache.ps1](Scripts/train-dns-cache.ps1) - trains the DNS cache with frequently used domain names
* [translate-file.ps1](Scripts/translate-file.ps1) - translates the given file from source to target language
* [translate-text.ps1](Scripts/translate-text.ps1) - translates the given text into other languages

View File

@ -0,0 +1,64 @@
#!/snap/bin/powershell
<#
.SYNTAX ./list-automatic-variables.ps1
.DESCRIPTION lists PowerShell automatic variables
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
try {
write-output "PowerShell Automatic Variables"
write-output "=============================="
write-output "`$ConsoleFileName= $ConsoleFileName"
write-output "`$Error = $Error"
write-output "`$Event = $Event"
write-output "`$EventArgs = $EventArgs"
write-output "`$EventSubscriber= $EventSubscriber"
write-output "`$ExecutionContext= $ExecutionContext"
write-output "`$false = $false"
write-output "`$foreach = $foreach"
write-output "`$HOME = $HOME"
write-output "`$input = $input"
write-output "`$IsCoreCLR = $IsCoreCLR"
write-output "`$IsLinux = $IsLinux"
write-output "`$IsMacOS = $IsMacOS"
write-output "`$IsWindows = $IsWindows"
write-output "`$LastExitCode = $LastExitCode"
write-output "`$Matches = $Matches"
write-output "`$MyInvocation.PSScriptRoot = $($MyInvocation.PSScriptRoot)"
write-output "`$MyInvocation.PSCommandPath = $($MyInvocation.PSCommandPath)"
write-output "`$NestedPromptLevel= $NestedPromptLevel"
write-output "`$null = $null"
write-output "`$PID = $PID"
write-output "`$PROFILE = $PROFILE"
write-output "`$PSBoundParameters= $PSBoundParameters"
write-output "`$PSCmdlet = $PSCmdlet"
write-output "`$PSCommandPath = $PSCommandPath"
write-output "`$PSCulture = $PSCulture"
write-output "`$PSDebugContext= $PSDebugContext"
write-output "`$PSHOME = $PSHOME"
write-output "`$PSItem = $PSItem"
write-output "`$PSScriptRoot = $PSScriptRoot"
write-output "`$PSSenderInfo = $PSSenderInfo"
write-output "`$PSUICulture = $PSUICulture"
write-output "`$PSVersionTable.PSVersion = $($PSVersionTable.PSVersion)"
write-output "`$PSVersionTable.PSEdition = $($PSVersionTable.PSEdition)"
write-output "`$PSVersionTable.GitCommitId = $($PSVersionTable.GitCommitId)"
write-output "`$PSVersionTable.OS = $($PSVersionTable.OS)"
write-output "`$PSVersionTable.Platform = $($PSVersionTable.Platform)"
write-output "`$PSVersionTable.PSCompatibleVersions = $($PSVersionTable.PSCompatibleVersions)"
write-output "`$PSVersionTable.PSRemotingProtocolVersion = $($PSVersionTable.PSRemotingProtocolVersion)"
write-output "`$PSVersionTable.SerializationVersion = $($PSVersionTable.SerializationVersion)"
write-output "`$PSVersionTable.WSManStackVersion = $($PSVersionTable.WSManStackVersion)"
write-output "`$PWD = $PWD"
write-output "`$Sender = $Sender"
write-output "`$ShellId = $ShellId"
write-output "`$StackTrace = $StackTrace"
write-output "`$switch = $switch"
write-output "`$this = $this"
write-output "`$true = $true"
exit 0
} catch {
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -1,16 +0,0 @@
#!/snap/bin/powershell
<#
.SYNTAX ./test.ps1
.DESCRIPTION simple PowerShell test script
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
try {
write-output "✔️ PowerShell works. Details are:"
echo $PSVersionTable
exit 0
} catch {
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}