在使用tscon的Process.Start时,我遇到了“系统找不到指定的文件异常”。
解决方法:
Process.Start(new ProcessStartInfo(@"c:\Windows\System32\notepad.exe", "temp.txt"));
不起作用:
Process.Start(new ProcessStartInfo(@"c:\Windows\System32\tscon.exe", @"0 /dest:console"));
我需要 tscon.exe。 为什么我会收到这个错误?
编辑:
1. 已验证 tscon.exe 确实在 c:\Windows\System32 文件夹中。 2. 我正在以管理员模式运行 VS。
这个文件被硬化了吗?无法理解。
tscon.exe
在 system32 目录下吗?你确定你可以使用你的凭据访问那个软件吗? - MarcoProcessStartInfo pi = new ProcessStartInfo();
pi.FileName = "cmd";
pi.WorkingDirectory = @"C:\windows\System32";
pi.Arguments = "@/k \"tscon.exe 0 /dest:console\"";
结果是一样的。但是,如果我手动打开命令提示符,则可以正常运行。 - Stevetscon.exe
是否位于c:\Windows\System32\
吗?我问这个是因为在我的 Windows 7 x64 Home Edition 中,它并不在那个位置。但我在C:\Windows\winsxs\amd64_microsoft-windows-t..es-commandlinetools_31bf3856ad364e35_6.1.7601.17514_none_42d65ed50fa3c682
找到了它。 - Răzvan Flavius Panda