Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2314

select-string Output problem

$
0
0

Hallo Powershell Community,

ich habe mal wieder ein Problem, wenn ich wie unten im Quelltext zu sehen versuche eine Datei zu öffnen und ein String zu manipulieren, funktioniert dies, aber sobald ich versuche den manipulierten String wieder in die Datei zu schreiben hat es nicht hin. Die Datei ist komplett leer egal was vorher drinstand.

Ich hoffe ihr könnt mir helfen.

$path="C:\script\file.ini"
select-string -path $path -pattern "Path=C:"  -allmatches –simplematch | Foreach-Object {
    $_ -replace 'Path=C:', 'Path=somewhere' `
    } | Out-File -FilePath "C:\script\file.ini" -encoding default -force



Viewing all articles
Browse latest Browse all 2314


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>