系统在进程启动(tscon.exe)中找不到指定的异常文件 [英] The system cannot find the file specified Exception in Process Start (tscon.exe)

查看:56
本文介绍了系统在进程启动(tscon.exe)中找不到指定的异常文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 tscon 上的 Process.Start 中收到系统找不到指定的文件异常"

I am getting "The system cannot find the file specified Exception" in Process.Start on tscon

工作:

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.为什么我会收到这个错误?

I need the tscon.exe. why am i getting this error?

  1. 验证 tscon.exe 确实在 c:\Windows\System32 文件夹中.
  2. 我在管理员模式下运行 VS

那个文件是否有一些强化?无法理解这一点...

is there some hardening on that file? not being able to understand this...

推荐答案

哦,这件事真的引起了我的注意.
我终于设法从 Process.Start 启动了 tscon.exe.
您需要传递您的管理员"帐户信息,否则会出现找不到文件"错误.

Oh well, this thing has really got my attention.
I have finally managed to start the tscon.exe from Process.Start.
You need to pass your "admin" account info, otherwise you get the 'File not found' error.

这样做

ProcessStartInfo pi = new ProcessStartInfo();
pi.WorkingDirectory = @"C:\windows\System32"; //Not really needed
pi.FileName = "tscon.exe";
pi.Arguments = "0 /dest:console";
pi.UserName = "steve";
System.Security.SecureString s = new System.Security.SecureString();
s.AppendChar('y');
s.AppendChar('o');
s.AppendChar('u');
s.AppendChar('r');
s.AppendChar('p');
s.AppendChar('a');
s.AppendChar('s');
s.AppendChar('s');
pi.Password = s;
pi.UseShellExecute = false; 
Process.Start(pi);

还要看命令的结果改下面两行

also to see the result of the command change the following two lines

pi.FileName = "cmd.exe";
pi.Arguments = "/k \"tscon.exe 0 /dest:console\"";

这篇关于系统在进程启动(tscon.exe)中找不到指定的异常文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆