C# 控制台应用程序:如何打开最大化的文本文件?

C# Console Application: How do I open a textfile maximized?

你好!(我是 Whosebug 新手)

我有一个关于 C# 控制台的问题。

我想打开同一目录中的 .txt 文件。 这是我的代码(文本文件的名称是README.txt):

string path = System.IO.Directory.GetCurrentDirectory() + @"\README.txt";
string[] FileContents = System.IO.File.ReadAllLines(path);                       
System.Diagnostics.Process.Start(path);

代码运行良好,但我希望文本文件以最大化方式打开。我该怎么做?

通过指定 ProcessStartInfo 参数:

string notepadPath = Environment.SystemDirectory + "\notepad.exe";

var startInfo = new ProcessStartInfo(notepadPath)
{
    WindowStyle = ProcessWindowStyle.Maximized,
    Arguments = "README.txt" 
};

Process.Start(startInfo);