File size: 437 Bytes
8c763fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

[CmdletBinding()]
param (
    [Parameter(Mandatory)]
    [string]
    $Value,

    [Parameter(Mandatory)]
    [string]
    $Encoding
)

$enc = [System.Text.Encoding]::GetEncoding($Encoding)
$data = $enc.GetBytes($Value)

$outStream = [System.Console]::OpenStandardOutput()
try {
    $outStream.Write($data, 0, $data.Length)
} finally {
    $outStream.Dispose()
}