1

Trying to change the cmd window colors. this does not work?

             ProcessStartInfo p1 = new ProcessStartInfo();
             p1.Verb = "runas";
             p1.FileName = "cmd.exe";
             p1.Arguments = "color 80";
             Process.Start(p1);
T Phillips
  • 49
  • 5

2 Answers2

2

Add /K:

ProcessStartInfo p1 = new ProcessStartInfo();
p1.Verb = "runas";
p1.FileName = "cmd.exe";
p1.Arguments = "/K color 80";
Process.Start(p1);

Reasoning: COLOR is an "internal command".

ulrichb
  • 19,610
  • 8
  • 73
  • 87
0

Do the following:

Process proc = new Process();
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.FileName = "cmd.exe";
proc.StartInfo.Arguments = "/T:17"; //this would be blue colour
proc.StartInfo.Domain = "domainname"; //use if domain user
proc.StartInfo.UserName = "username";
proc.StartInfo.Password = "password";
proc.Start();

For the colours issue you can see here how to set:

http://ss64.com/nt/color.html

NicoRiff
  • 4,803
  • 3
  • 25
  • 54