【发布时间】:2012-06-07 07:31:55
【问题描述】:
我在 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。 为什么会出现这个错误?
编辑:
- 已验证 tscon.exe 确实在
c:\Windows\System32文件夹中。 - 我在管理员模式下运行 VS
该文件是否有一些强化?无法理解这个...
【问题讨论】:
-
您确定
tscon.exe在system32 目录中吗?您确定可以使用您的凭据访问该软件吗? -
尝试使用“以管理员身份运行..”运行您编译的 exe,看看它是否没有权限。
-
只能确认OP语句。也试过
ProcessStartInfo pi = new ProcessStartInfo();pi.FileName = "cmd";pi.WorkingDirectory = @"C:\windows\System32";pi.Arguments = "@/k \"tscon.exe 0 /dest:console\"";,结果是一样的。但是,如果我从手动打开的命令提示符中尝试,它可以工作。 -
再次询问,只是为了确定,您是否检查过
tscon.exe位于c:\Windows\System32` ? I'm asking cause I don't have it at that location in my Windows 7 x64 Home Edition. I did found it in:C:\Windows\winsxs\amd64_microsoft-windows-t..es-commandlinetools_31bf3856ad364e35_6.1.7601.17514_none_42d65edcfa6825 ` 不过。 -
@RăzvanPanda 如果您以管理员权限打开命令提示符(以管理员身份运行),您将看到该文件。