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

PREVIOUS NEXT
Code Example
Csharp :: c# add guid to array 
Csharp :: c# unity 2d play video 
Csharp :: csharp datetime string format 
Csharp :: how to add a delay in csharp 
Csharp :: get the current directory in unity 
Csharp :: remove character from string c# 
Csharp :: How can I cast string to enum? 
Csharp :: binding command to event wpf 
Csharp :: c# const string array 
Csharp :: c# string newline 
Csharp :: remove all letters from string c# 
Csharp :: how to parse a string to an integer c# 
Csharp :: unity agent bake not derecting mesh 
Csharp :: unity object to mouse 
Csharp :: += meaning c# 
Csharp :: c# datetime now timestamp 
Csharp :: c# tryparse int 
Csharp :: convert string to date c# ddmmyyy 
Csharp :: c# repeat x times 
Csharp :: c# choose first n elements from list 
Csharp :: c# linq to dictionary 
Csharp :: unity destroy object invisible 
Csharp :: cs entity framework 
Csharp :: compare two binary tree 
Csharp :: dynamic convert type c# 
Csharp :: how to move towards an object unity 
Csharp :: how to display an image url in c# picturebox 
Csharp :: c# list of strings 
Csharp :: c# filter list 
Csharp :: c# create array 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =