Warning: file_exists(): open_basedir restriction in effect. File(/bin/bash) is not within the allowed path(s): (/var/www/clients/client0/web58/web:/var/www/clients/client0/web58/private:/var/www/clients/client0/web58/tmp:/var/www/testwiki.znil.net/web:/srv/www/testwiki.znil.net/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom;/gitinfo) in /var/www/clients/client0/web58/web/includes/shell/CommandFactory.php on line 119

Deprecated: Use of MediaWiki\Parser\ParserOutput::addJsConfigVars was deprecated in MediaWiki 1.38. [Called from DisplayComments::getParserHandler in /var/www/clients/client0/web58/web/extensions/Comments/includes/parser/DisplayComments.php at line 29] in /var/www/clients/client0/web58/web/includes/debug/MWDebug.php on line 385
PowerShell aktuellen Pfad des Skripts ermitteln – testznilwiki
 Aktionen

PowerShell aktuellen Pfad des Skripts ermitteln

Aus testznilwiki

Ausgangslage:
Wir möchten den Pfad haben in dem unser PowerShell .ps1 Skript gerade läuft.


Lösung:

function Get-ScriptDirectory {
    $Invocation = (Get-Variable MyInvocation -Scope 1).Value
    Split-Path $Invocation.MyCommand.Path
}

$installpath = Get-ScriptDirectory

In der $installpath steht nun der aktuelle Pfad drin.

Hab ich irgendwo mal per Google gefunden ... vermutlich unter http://blogs.msdn.com/b/powershell/archive/2007/06/19/get-scriptdirectory.aspx, steht aber an noch mehr Stellen.



Loading comments...