親フォルダ
01.$code = @"
02.using System;
03.using System.IO;
04.using System.Text;
05. 
06.public class Program
07.{
08.    public static void Main()
09.    {
10.        Console.WriteLine(Environment.CurrentDirectory);
11. 
12.        string path = @"text-input-all.ps1";
13.        if ( File.Exists(path) )
14.        {
15.            Console.WriteLine("text-input-all.ps1 は存在しています");
16.        }
17. 
18.        // SHIFT_JIS
19.        Encoding Enc = Encoding.GetEncoding(932);
20.        // EUC-JP
21.        //Encoding Enc = Encoding.GetEncoding(51932);
22.        // UNICODE 用
23.        //Encoding Enc = Encoding.GetEncoding(1200);
24.        // UTF-8N
25.        //Encoding Enc = new UTF8Encoding();
26.        // UTF-8
27.        //Encoding Enc = new UTF8Encoding(true);
28. 
29.        try
30.        {
31.            using (StreamReader ReadFile = new StreamReader(path, Enc))
32.            {
33.                // 読込み
34.                string Text = ReadFile.ReadToEnd();
35. 
36.                // 全て読み込んでいるので閉じる
37.                ReadFile.Close();
38. 
39.                Console.WriteLine(Text);
40.            }
41. 
42.        }
43.        catch (Exception ex)
44.        {
45.            Console.WriteLine(ex.Message);
46.        }
47. 
48.        Console.ReadLine();
49.    }
50.}
51."@
52. 
53.Add-Type -Language CSharp -TypeDefinition $code
54.  
55.[Program]::Main()
実行用バッチファイル

powershell .\text-input-all.ps1
元となる C# のソースコード PowerShell でスクリプトの実行を許可する手順