Powershell: echo "" > file.txt VS clear-content file.txt -


depending on how clear file in powershell, garbage.

echo "" > ".\file.txt" or clear-content ".\file.txt" [io.file]::appendalltext("file.txt", "teststring") 

using clear-content, "teststring" in "file.txt".

using echo "" > ".\file.txt", garbage chinese characters.

why? echo "" > file mess encoding?

echo powershell alias write-output.

i'm not sure redirecting output of write-output file resulting in.

i can duplicate results, chinese characters, encoding of file seems ascii (i used function test file encoding: http://poshcode.org/2059).

just running echo "" > ".\file.txt" puts 6 bytes in file: 255, 254, 13, 0, 10, 0 whereas running set-content .\file.txt "" puts 2 bytes: 13, 10.

but understand question is: why command result in output.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

android - IBM Worklight 6.1 [Application Error] There was a network error (file:///android_asset/www/index.html) -