Skip to main content

PowerShell Variablen


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

Variable
Typ Beschreibung $PSScriptRoot System.String Der Pfad zum Ordner worin sich das aktuelle Skript befindet $PSCommandPath System.String Vollständiger Pfad zum aktuellen Skript $PSModulePath   Beinhaltet die Pfade zu den Modulen $MyInvocationPSScriptRoot Der Pfad zum Ordner worin sich das aktuelle Skript befindet InvocationInfo$MyInvocation Enthält Infos darüber, wie das Skript aufgerufen wurde

$PSScriptRoot

    Datentyp: System.String

    $PSCommandPath

      Datentyp: System.String

      $PSScriptRoot

        Datentyp: 

        $MyInvocation

          Datentyp: InvocationInfo

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

            $MyInvocation.MyCommand 

            Informationen und die Idendität des aktuellen Kommando-Objekts

              $MyInvocation.MyCommand.CommandType

              $MyInvocation.MyCommand.Path 

              EnhältEnthält den Pfad zum aktuellen Skript