gpt4 book ai didi

c# - 在 C# 中用 Notepad++ 打开文件进行阅读

转载 作者:行者123 更新时间:2023-11-30 19:37:23 25 4
gpt4 key购买 nike

我尝试用 C# 语言用 Notepad++ 打开文件进行阅读。我使用这个命令:

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

notepad++ 无法用全名打开这个文件,

notepad++将名字截成4部分,并返回此信息

c:\file doesn't exist.create it?

c:\name doesn't exist.create it?

c:\for doesn't exist.create it?

c:\test.txt doesn't exist.create it?

Notepad++ 版本:9.4.2

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

最佳答案

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

试试这个:

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

关于c# - 在 C# 中用 Notepad++ 打开文件进行阅读,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38247311/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com