O'Reilly logo

Scripting mit Windows PowerShell 2.0 - Der Einsteiger-Workshop by Tobias Weltner Dr.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Textmuster und reguläre Ausdrücke

Textmuster können recht beschaulich sein. Möchten Sie wissen, ob ein Text ein bestimmtes Stichwort enthält, greifen Sie zum Operator -like. Damit kann man Texte also auf relativ simple Art validieren und den Inhalt von Textdateien filtern:

PS> 'Das Kennwort lautet: streng geheim' -like '*Kennwort*' True PS> Get-Content $env:windir\windowsupdate.log | Where-Object { $_ -like '*Warning:*' } 2010-02-15 09:00:07:346 676 16cc DtaStor WARNING: Attempted to add URL http://download.windowsupdate.com/msdownload/update/software/ftpk/2009/09/ 3127922_efd1b6e88dca0406420a85f24eb9497135f89f0a.cab for file 79G26I3KBAZCCoXyTrlJcTX4nwo= when file has not been previously added to the datastore 2010-02-15 11:47:01:166 676 f58 PT ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required