Benutzer-Werkzeuge

Webseiten-Werkzeuge


programmierung:powershell

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
programmierung:powershell [2012-07-10 08:50]
stefan
programmierung:powershell [2014-04-05 11:42] (aktuell)
Zeile 1: Zeile 1:
 ====== Some common tasks in Windows PowerShell ====== ====== Some common tasks in Windows PowerShell ======
   * suppress output of Cmdlets (e.g. ''​new-item''​):​ pipe to ''​out-null''​   * suppress output of Cmdlets (e.g. ''​new-item''​):​ pipe to ''​out-null''​
 +  * suppress error output of binaries: ''​svn log 2> $null''​
   * suppress error messages (even those that won't go away with ''​-ea 0''​):​ ''​$ErrorActionPreference = "​silentlycontinue"''​   * suppress error messages (even those that won't go away with ''​-ea 0''​):​ ''​$ErrorActionPreference = "​silentlycontinue"''​
   * check if an error occured (e.g. after cmdlet with suppressed output): ''​if (!$?​)''​   * check if an error occured (e.g. after cmdlet with suppressed output): ''​if (!$?​)''​
Zeile 9: Zeile 10:
   $str = $m[0].Groups[1].ToString();​   $str = $m[0].Groups[1].ToString();​
 }</​code>​ }</​code>​
 +  * get name and path of the currently running script: <code posh>​$scriptName = $MyInvocation.MyCommand.Name;​
 +$scriptPath = split-path $MyInvocation.MyCommand.Path;</​code>​
programmierung/powershell.1341903018.txt.gz · Zuletzt geändert: 2014-04-05 11:42 (Externe Bearbeitung)