使用 Process.Start 在 PFE 中打开文本文件
我想知道你是否能帮我解决这个问题。我查过谷歌但什么也没找到。
我有一个程序,一旦完成比较两个文件,它就会将所有差异写入一个文本文件。我有 2 个单选按钮,一个在记事本中打开,另一个在 PFE(程序员文件编辑器)中打开。
我的 PFE.exe 位于“C:\Program Files (x86)\PFE\PFE.exe”中,记事本位于默认位置。
我的代码是:
using System.Diagnostics;
...
if (radioButton1.Checked)
{
Process.Start("notepad.exe", File1.Text);
}
if (radioButton2.Checked)
{
Process.Start("PFE32.exe", File1.Text);
}
现在,只需“Process.Start("notepad.exe", File1.Text);”工作正常,没有 if 语句。
因此,我的问题是 - 你能帮我弄清楚为什么 PFE 无法打开文本文件吗?
谢谢你们!
I wonder if you can help me with this one. I have looked on Google but found nothing.
I have a program, that once it is finished comparing 2 files together, it writes out all the differences to a text file. I have 2 radio buttons, one to open in Notepad and the other to open in PFE (Programmers File Editor).
My PFE.exe is in "C:\Program Files (x86)\PFE\PFE.exe" and Notepad is where it normally is by default.
My code is:
using System.Diagnostics;
...
if (radioButton1.Checked)
{
Process.Start("notepad.exe", File1.Text);
}
if (radioButton2.Checked)
{
Process.Start("PFE32.exe", File1.Text);
}
Now, just "Process.Start("notepad.exe", File1.Text);" works fine, without the if statements.
So, therefore, my question is - Can you help me figure out why PFE won't open with the text file?
Thank you guys!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
找不到 PFE32.exe,因为它不在
PATH
环境变量中声明的任何目录中。您需要将
C:\Program Files (x86)\PFE
添加到路径变量或使用完整路径调用 PFE32.exe。PFE32.exe is not found, because it is not in any of the directories declared in the
PATH
environment variable.You need to either add
C:\Program Files (x86)\PFE
to the path variable or call PFE32.exe with the full path.第二个参数是命令的参数,记事本不需要参数名称,只需要文件名即可工作。
也许 PFE 采用命名参数,例如:
pfe32.exe -path:C:\myfile.txt
The second parameter is arguments to the command, notepad doesn't need an argument name, just the file name to work.
Perhaps PFE takes a named argument like:
pfe32.exe -path:C:\myfile.txt