📜  在记事本中打开文本文件 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:38.440000             🧑  作者: Mango

代码示例1
private void button1_Click(object sender, EventArgs e)
    {
        string filename = "license.txt";
        if (!System.IO.File.Exists(filename))
            System.IO.File.WriteAllText(filename, Properties.Resources.License);
        // let windows decide which program it will use to open the file ...
        // whatever registered application for .txt extension is on the user system
        System.Diagnostics.Process.Start(filename);

        // or explicitely open file in notepad
        //System.Diagnostics.Process.Start("notepad.exe", filename);
    }