Tragen Sie mit mir, wenn ich dies aus Erinnerung mache, aber das sollte den Trick tun:
$objWord = New-Object -comobject Word.Application $objWord.Visible = $false $list = Get-ChildItem "c:\users\stefan\test\*.*" -Include *.doc* foreach($item in $list){ $objDoc = $objWord.Documents.Open($item.FullName,$true) $objDoc.TrackRevisions = $true $objDoc.ShowRevisions = $true $objSelection = $objWord.Selection $wdFindContinue = 1 $FindText = "Sara" $MatchCase = $False $MatchWholeWord = $true $MatchWildcards = $False $MatchSoundsLike = $False $MatchAllWordForms = $False $Forward = $True $Wrap = $wdFindContinue $Format = $False $wdReplaceNone = 0 $ReplaceWith = "AJMOO" $wdFindContinue = 1 $ReplaceAll = 2 $a = $objSelection.Find.Execute($FindText,$MatchCase,$MatchWholeWord, ` $MatchWildcards,$MatchSoundsLike,$MatchAllWordForms,$Forward,` $Wrap,$Format,$ReplaceWith,$ReplaceAll) $objDoc.Save() $objDoc.Close() } $objWord.Quit()