Variables

This page will have a detailed look on variables.

The first thing you need to know: what is a variable? In your script it looks like a word that begins with a $ ($myVar). But inside the pc, you say to your memory "hey give me some space (reserve some memory) to store my data in.

Sometimes you see people talking about integers, strings, booleans, etc... what is this? Well when you reserve some memory it would be nice if the memory knew how much (there are other things to but we will go not further than this). Let's say we want to store a byte in $myByte. Then the memory knows it should reserve 1 byte of space to store the byte. It's simple to write it in code: [byte]$myByte

Variables should always start with a $. These characters are illegal to use in a variable name: ! @ # % & , . and space. Variable names are not case sensitive.

Available data types

Here's a list of some available types in PowerShell:

Reserved keywords

When choosing a variable name you can come up with almost everything but you cannot use these reserved keywords:

Reserved variables

In PowerShell there is also a list of variables that you cannot use because PowerShell uses them.

To get the full list with all info type in Get-Help about_automatic_variables.

This page will be updated soon...