Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

how to do cmd command c#

System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/C copy /b Image1.jpg + Archive.rar Image2.jpg";
process.StartInfo = startInfo;
process.Start();
Comment

how to do cmd command c#

string strCmdText;
strCmdText= "/C copy /b Image1.jpg + Archive.rar Image2.jpg";
System.Diagnostics.Process.Start("CMD.exe",strCmdText);
Comment

c# cmd

string param="java -jar -Xmx4000m train_one.jar class_funnyai.ini 12011 10";
run_cmd(param);

void run_cmd(string param)
{
	var proc = new Process();
	proc.StartInfo.FileName = "cmd.exe";
  
	// set up output redirection
	proc.StartInfo.RedirectStandardInput= true;
	proc.StartInfo.RedirectStandardOutput = true;
	proc.StartInfo.RedirectStandardError = true;
	proc.EnableRaisingEvents = true;
	proc.StartInfo.CreateNoWindow = true;
	proc.StartInfo.StandardOutputEncoding = Encoding.UTF8;

	// see below for output handler
	proc.ErrorDataReceived += callback_data;
	proc.OutputDataReceived += callback_data;

	proc.Start();

	using (StreamWriter sw = proc.StandardInput)
	{
		if (sw.BaseStream.CanWrite)
		{
			sw.WriteLine(param);
		}
	}


	proc.BeginErrorReadLine();
	proc.BeginOutputReadLine();

	proc.WaitForExit();
}

void callback_data(object sender, DataReceivedEventArgs e)
{
	Console.WriteLine(e.Data);
}
Comment

how to start cmd in c#

string strCmdText = "pip install -r requirements.txt";
Process.Start("CMD.exe", strCmdText);
Comment

PREVIOUS NEXT
Code Example
Csharp :: unity destroy object when out of screen 
Csharp :: c# get wifi ip address 
Csharp :: c# form formborderstyle none move 
Csharp :: csharp get integer part of number 
Csharp :: load scene unity 
Csharp :: find unity 
Csharp :: unity movetowards 2d 
Csharp :: c# string to datetime 
Csharp :: get filename from path c# 
Csharp :: c# kill all processes by name 
Csharp :: c# write to console 
Csharp :: pass parameter to thread c# 
Csharp :: how to create a new folder with c# 
Csharp :: unity url 
Csharp :: sum of two numbers in c# 
Csharp :: how to make a dragable object in unity2D 
Csharp :: unity vector3.distance giving nonsensical values 
Csharp :: remove end character of string c# 
Csharp :: snx turn off linux 
Csharp :: c# memorystream to byte array 
Csharp :: list of gender binary terrorists 
Csharp :: unity how to reorder a list 
Csharp :: how to convert a number to 2 decimal places in c# 
Csharp :: move file from one folder to another c# 
Csharp :: SIMPLE HTTP REQUEST C# 
Csharp :: data table rename column c# 
Csharp :: rotation facing mouse unity 
Csharp :: stop flickering 
Csharp :: unity3d change player position 
Csharp :: c# int to hex 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =