string - uUable to use the output of the command "SFC /scannow" in powershell -
what have done in powershell:
$sfc = sfc /scannow write-output $sfc | out-file d:\cours\powershell\sfc.txt $string = 'd d n o t f n d n y n t e g r t y v o l t o n s' $test = $false $sfc | foreach {if ($_.name -match $string) {$test = $true}} if ($test -eq $false) {write-host 'ok'}
what in file 'sfc.txt' unreadable notepad++.
more, $test
equal $false
(and that's not true).
what save output correctly in file in order able read , testing output?
out-file
defaults writing in unicode. can change -encoding ascii
.
you can use set-content
defaults ascii.
you might able tell notepad++ interpret file unicode, i'm not familiar how that.
Comments
Post a Comment