+ 3
onClick -> загрузить файл
Как загрузить какой либо файл при нажатии на кнопку? Это c#, visual studio 2010
5 Answers
+ 2
Cmd file
+ 2
it's a *.cmd file, where are commands to command prompt, i want to execute it
+ 1
What kind of file do you want to load ?
What do you want to do ?
0
What do you want to do with the command file ?
Execute it or read the text in the file ?
0
Please have a look at these links.
https://stackoverflow.com/questions/1469764/run-command-prompt-commands
System.Diagnostics.Process.Start("CMD.exe",strCmdText);
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();
https://stackoverflow.com/questions/206323/how-to-execute-command-line-in-c-get-std-out-results
// Start the child process.
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "YOURBATCHFILE.bat";
p.Start();
// Do not wait for the child process to exit before
// reading to the end of its redirected stream.
// p.WaitForExit();
// Read the output stream first and then wait.
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();