TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

PowerShell Automatic Variables

PowerShell Automatic Variables with What is PowerShell, History of PowerShell, Features of PowerShell, PowerShell vs CMD, PowerShell Scripting, PowerShell Versions, PowerShell Commands, PowerShell Looping, PowerShell Conditions, PowerShell Array, PowerShell Brackets etc.

<< Back to POWERSHELL

Automatic Variables

The automatic variables are those variables that store the state of the Windows PowerShell. These variables will contain the information of a user and the system, default variables, runtime variables, and PowerShell settings. These variables can be created and maintained by Windows PowerShell.

Following is the list of automatic variables in PowerShell:

Variable name Description
$$ This variable is used to represent the last token in the last line, which is received by the session.
$? This variable is used to represent the execution status of the last operation. If there is no error, it returns a True value otherwise False.
$^ This variable is used to represent the first token in the last line, which is received by the session.
$_ This variable acts as $PSItem. It contains the current object in the pipeline object.
$args This variable contains an array of values for undeclared parameters that are passed to a script, function, or script block.
$ConsoleFileName This variable is used to represent the path of the console file, which was recently used in the session.
$Error This variable is used to contain an array of error objects which represent the most recent errors.
$Event This variable is used to contain an object of PSEventArgs. PSEventArgs is an object used to represent an event that is being processed.
$EventSubscriber This variable is used to contain an object of PSEventSubscriber. This object shows you an event subscriber of an event that is being processed.
$EventArgs This variable is used to contain an object which represents the argument of the first event.
$false This variable is used to represent the False.
$foreach This variable is used to contain the enumerators of a ForEach loop. This variable exists only while the ForEach loop is executing. And it will be deleted after completion of the loop.
$Home This variable is used to represent the full path of the user's home directory.
$input This variable contains an enumerator that enumerates all the inputs passed to the function. It is only available to script blocks and functions.
$Host This variable contains an object which shows a current host application for the Windows PowerShell.
$IsLinux If the current session is running on the Linux operating system, this variable contains a $True, otherwise $False.
$IsWindows If the current session is running on the Windows operating system, this variable contains a $True, otherwise $False.
$IsMacOS If the current session is running on MacOS operating system, this variable contains a $True, otherwise $False.
$null This variable is used to represent a null or empty value. We can use it to represent an absent or undefined value in script and commands.
$PID This variable displays the PID of the process, which is hosting the session of the current PowerShell.
$PSItem This variable acts as $_. It contains the current object in the pipeline object.
$PSHome This variable represents the full path of the installation directory for the Windows PowerShell.
$PSVersionTable This variable is used to represent the read-only hash table, which displays the details about the version of PowerShell running in the current session.
$PWD This variable is used to contain the path object, which shows you a full path of the current directory.
$ShellId This variable is used to represent the identifier of the current shell.





Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf