Werbung

Herkunft

Kurzinformation

Switches between commented and uncommented text

Syntax

<# .Synopsis Switches between commented and uncommented text .Description Takes a block of text. Uncomments lines that are commented out and comments lines that are not already commented out. .Example Switch-CommentOrText $psise.CurrentFile.SelectedText #> param( # The text in which to toggle comments. [Parameter(Mandatory=$true, ValueFromPipeline=$true)] [String]$text ) process { $returnedText = "" foreach ( $line in $text -split ` [System.Environment]::NewLine ) { if ( $line.length -gt 0) { if ( $line -match "^#" ) { $line = $line -replace "^#", "" } else { $line = $line -replace "^", "#" } $returnedText += "{0}{1}" -f $line, ` [System.Environment]::NewLine } } $returnedText }

Beschreibung

Takes a block of text. Uncomments lines that are commented out and comments lines that are not already commented out.

Links

Liste aller Commandlets Mehr über die Windows PowerShell

Bücher zur PowerShell

Buchcover Windows PowerShell 5.0 - Das Praxishandbuch (1. Auflage 2016/5. Auflage Gesamtreihe) Windows PowerShell 5.0 - Das Praxishandbuch (1. Auflage 2016/5. Auflage Gesamtreihe)
Autoren: Dr. Holger Schwichtenberg
erschienen 2016, 996 Seiten, 49,99 €
ISBN: 3446446435
Bestellung: Amazon.de oder im Buchhandel über ISBN 3446446435

Schulungen/Seminare

Offene Seminare zur PowerShell
In-House-Seminare zur PowerShell