# PowerShell Variablen

Variablen die von PowerShell je nach Kontext, selbst deklariert werden.

<table border="1" id="bkmrk-variable-beschreibun" style="border-collapse: collapse; width: 100%; height: 300px;"><colgroup><col style="width: 19.1895%;"></col><col style="width: 80.8105%;"></col></colgroup><thead><tr style="height: 29.8px;"><td class="align-center" style="height: 29.8px;">**Variable**</td><td class="align-center" style="height: 29.8px; padding-left: 40px;">**Beschreibung**</td></tr></thead><tbody><tr style="height: 30.4667px;"><td class="align-center" style="height: 30.4667px;"><span style="color: rgb(53, 152, 219);">`$PSCommandPath`</span></td><td style="height: 30.4667px;">Vollständiger Pfad zum aktuellen Skript</td></tr><tr style="height: 30.4667px;"><td class="align-center" style="height: 30.4667px;"><span style="color: rgb(35, 111, 161);">`<span style="color: rgb(53, 152, 219);">$PSModulePath</span>`</span></td><td style="height: 30.4667px;">Beinhaltet die Pfade zu den Modulen</td></tr><tr><td class="align-center" style="height: 30.4667px;">`<span style="color: rgb(53, 152, 219);">$PSScriptRoot</span>`</td><td style="height: 30.4667px;">Der Pfad zum Ordner worin sich das aktuelle Skript befindet</td></tr><tr style="height: 29.8px;"><td class="align-center" style="height: 29.8px;">`<span style="color: rgb(53, 152, 219);">$MyInvocation</span>`</td><td style="height: 29.8px;">Enthält Infos darüber, wie das Skript aufgerufen wurde</td></tr></tbody></table>

### <span style="color: rgb(53, 152, 219);">`$PSScriptRoot`</span>

- **Datentyp:** <span style="color: rgb(185, 106, 217);">`System.String`</span>

### <span style="color: rgb(53, 152, 219);">`$PSCommandPath`</span>

- **Datentyp:** <span style="color: rgb(185, 106, 217);">`System.String`</span>

### <span style="color: rgb(53, 152, 219);">`$PSScriptRoot`</span>

- **Datentyp:**

### <span style="color: rgb(35, 111, 161);">`<span style="color: rgb(53, 152, 219);">$MyInvocation</span>`</span>

- **Datentyp:** <span style="color: rgb(251, 238, 184);">`InvocationInfo`</span>

Enthält Infos darüber, wie das Skript aufgerufen wurde

- <span style="color: rgb(255, 255, 255);">`<span style="color: rgb(53, 152, 219);">$MyInvocation</span>.<span style="color: rgb(251, 238, 184);">MyCommand</span>` </span>– Informationen und die Idendität des aktuellen Kommando-Objekts
- - <span style="color: rgb(255, 255, 255);">`<span style="color: rgb(53, 152, 219);">$MyInvocation</span>.<span style="color: rgb(251, 238, 184);">MyCommand.CommandType</span>`</span>
    - <span style="color: rgb(255, 255, 255);">`<span style="color: rgb(53, 152, 219);">$MyInvocation</span>.<span style="color: rgb(251, 238, 184);">MyCommand.Path</span>` </span>– Enthält den Pfad zum aktuellen Skript