Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
C# のコマンドラインからファイルを読み取るにはどうすればよいですか? コマンドの例は次のとおりです。
program.exe < textfile
入力/出力のリダイレクトは、言語に関係なくすべての実行可能ファイルに対して機能します。
したがって、標準入力から通常の方法でファイルを読み取るだけです
P0W が指摘したように、これは C# ではなく cmd.exe の機能です。ただし、C# では、さまざまな Console.ReadXXX メソッドを使用して標準入力からデータを取得します。