Use System.IO.File .NET Framework class’s Write AllText static method.
[System.IO.File]::WriteAllText(string path, string contents)
or [System.IO.File]::WriteAllText(string path, string contents, System.Text.Encoding encoding)
e.g. [system.io.file]::WriteAllText(“c:\fso\ioascii.txt”, $count, [System.Text.Encoding]::ascii)
More info: [system.io.file] | get-member –static WriteAllText | fl *
[system.text.encoding] | get-member –static –MemberType property
No comments:
Post a Comment