我想启动记事本,使用用户从我已经使用Process.Start提供的文档列表中选择的文件名。当我使用该方法时,它抛出错误“系统找不到指定的文件”。
我的代码:
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = @"C:\WINDOWS\system32\notepath.exe";
startInfo.Arguments = @"C:\folder\a.txt";
Process.Start(startInfo); 发布于 2011-09-21 16:36:50
尝尝这个
ProcessStartInfo info = new ProcessStartInfo(@"C:\WINDOWS\system32\notepath.exe");有关详细信息,请访问here
发布于 2011-09-21 16:40:11
“我要使用'process.start‘方法显示文件夹中的文档列表。”这是完全错误的。
要列出文件夹中的文件,请使用Directory.GetFiles()
发布于 2018-04-04 17:47:28
这个怎么样?这样做还可以确保即使路径中包含空格,也会显示您的文件
var proc = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = @"C:\Windows\System32\notepad.exe",
Arguments = $"\"{filePath}\"",
}
};
proc.Start();*您使用的是notepath.exe,我想您会喜欢使用notepad.exe,因此我更改了可执行文件的名称!
https://stackoverflow.com/questions/7496825
复制相似问题