I am getting "The system cannot find the file specified Exception" in Process.Start on tscon
Working:
Process.Start(new ProcessStartInfo(@"c:\Windows\System32\notepad.exe", "temp.txt"));
Not Working:
Process.Start(new ProcessStartInfo(@"c:\Windows\System32\tscon.exe", @"0 /dest:console"));
I need the tscon.exe. why am i getting this error?
EDIT:
c:\Windows\System32
folder.is there some hardening on that file? not being able to understand this...
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.
Do in this way
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\"";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With