...

Programming languages - Powershell

Back to Course

Lesson Description


Lession - #110 PowerShell-Special Variables


The special variables are those variables that store the condition of the Windows PowerShell. These powershell variables will contain the information of a client and the system, default variables , runtime variables , and PowerShell settings. These variables can be made and kept up with by Windows PowerShell.

Following is the rundown of programmed variables in PowerShell:
Variable name Description
$$ This variable is utilized to address the last token in the last line, which is gotten by the session.
$? This variable is utilized to address the execution status of the last activity. Assuming there is no mistake, it returns a True worth in any case False.
$^ This variable is utilized to address the principal token in the last line, which is gotten by the session.
$_ This variable goes about as $PSItem. It contains the ongoing item in the pipeline object.
$args This variable contains a array of values for undeclared boundaries that are passed to a script, function, or script block.
$ConsoleFileName This variable is utilized to address the path of the control console file, which was as of late utilized in the session.
$Error This variable is utilized to contain a array of blunder objects which address the latest errors.
$Event This variable is utilized to contain an object of PSEventArgs. PSEventArgs is an article used to address an occasion that is being handled.
$EventSubscriber This variable is utilized to contain an object of PSEventSubscriber. This item shows you an event subscriber of an event that is being handled.
$EventArgs This variable is utilized to contain an item which addresses the contention of the main event .
$false This variable is utilized to address the False.
$foreach This variable is utilized to contain the enumerators of a ForEach circle. This variable exists just while the ForEach circle is executing. Furthermore, it will be erased after fruition of the circle.
$Home This variable is utilized to address the full way of the client's home catalog.
$input This variable contains an enumerator that counts every one of the sources of info passed to the function. script blocks and functions is just accessible.
$Host This variable contains an item which shows an ongoing host application for the Windows PowerShell.
$IsLinux If the ongoing meeting is running on the Linux operating system, this variable contains a $True, in any case $False.
$IsWindows If the ongoing meeting is running on the Windows working framework, this variable contains a $True, in any case $False.
$IsMacOS If the ongoing session is running on MacOS working framework, this variable contains a $True, in any case $False.
$null This variable is utilized to address an invalid or void worth. We can involve it to address a missing or indistinct worth in content and orders.
$PID This variable shows the PID of the cycle, which is facilitating the session of the ongoing PowerShell.
$PSItem This variable goes about as $_. It contains the ongoing article in the pipeline object.
$PSHome This variable addresses the full way of the establishment index for the Windows PowerShell.
$PSVersionTable This variable is utilized to address the read-just hash table, which shows the insights concerning the rendition of PowerShell running in the ongoing session .
$PWD This variable is utilized to contain the session object, which shows you a full way of the ongoing index.
$ShellId This variable is utilized to address the identifier of the ongoing shell.