Declaring a variable in PowerShell is usually a simple matter. Just specify the variable name, an equal sign, and the value you want to assign to the variable. Then PowerShell will do the rest. Despite this simplicity, you can make working with variables easier with a few extra tricks. For instance, you can define constants and use variables as items.
In this article, we shall see 3 variable-related techniques, including renaming variables, showing all variables, and working with constants.
Playing with Powershell Variables