用c#中的notepad ++打开文件进行读取

abd*_*sup 2 c#

我试着用c#语言用notepad ++打开文件进行阅读.我用这个命令:

Process myProcess = new Process();
Process.Start("notepad++.exe", @"c:\file name for test.txt");
Run Code Online (Sandbox Code Playgroud)

notepad ++无法使用全名打开此文件,

notepad ++将名称剪切为4部分,并返回此消息

c:\ file不存在.创建它?

c:\name不存在.创建它?

c:\ for不存在.创建它?

c:\ test.txt不存在.创建它?

版本的记事本++:9.4.2

在较新的版本中我没有这个问题,但我需要在所有版本中使用notepad ++.

Mat*_*son 8

您缺少文件名周围的引号.

试试这个:

Process myProcess = new Process(); 
Process.Start("notepad++.exe", "\"c:\\file name for test.txt\"");
Run Code Online (Sandbox Code Playgroud)

  • 为什么你有 Process myProcess = new Process(); ? (2认同)