Home/PowerShell/PowerShell’s Variables

PowerShell’s Variables

Windows PowerShell is designed to be an interactive command-line shell and it’s also a programming language. A PowerShell script is really nothing more than a simple text file. The file contains a series of PowerShell commands, with each command appearing on a separate line.

If we need to run the PowerShell script using the notepad then its filename needs to save as .PS1 extension.

Powershell Variables

Is It Case Sensitive

The answer is “YES”, power shell comments are case sensitive. 

  • As like other programming language, we need to declare the variable as like below. The main difference is we need to add prefix with ‘$’ symbol in the variable.
  • All we have to do to declare those variables is add a dollar sign, then use whatever name for the variable we want and no spaces are allowed in the variable name.

Example 1: 

Example 2: 

 

Leave A Comment