abdosup
abdosup

Reputation: 107

open file for reading with notepad++ in c#

I try to open file for reading with notepad++, in c# language. I use this command:

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

notepad++ can't open this file with full name,

notepad++ cut the name at 4 part, and return this message

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?

version of notepad++ : 9.4.2

In the newer version I do not have this problem but I need to use notepad++ with all versions.

Upvotes: 4

Views: 9651

Answers (1)

Matthew Watson
Matthew Watson

Reputation: 109557

You are missing the quotes around the filename.

Try this:

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

Upvotes: 13

Related Questions