+ 3

onClick -> загрузить файл

Как загрузить какой либо файл при нажатии на кнопку? Это c#, visual studio 2010

22nd Nov 2019, 8:14 PM
🇭🇺 Rómányi Téčka 🇭🇺
🇭🇺 Rómányi Téčka 🇭🇺 - avatar
5 Answers
+ 2
Cmd file
22nd Nov 2019, 8:59 PM
🇭🇺 Rómányi Téčka 🇭🇺
🇭🇺 Rómányi Téčka 🇭🇺 - avatar
+ 2
it's a *.cmd file, where are commands to command prompt, i want to execute it
22nd Nov 2019, 9:03 PM
🇭🇺 Rómányi Téčka 🇭🇺
🇭🇺 Rómányi Téčka 🇭🇺 - avatar
+ 1
What kind of file do you want to load ? What do you want to do ?
22nd Nov 2019, 8:58 PM
sneeze
sneeze - avatar
0
What do you want to do with the command file ? Execute it or read the text in the file ?
22nd Nov 2019, 9:01 PM
sneeze
sneeze - avatar
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();
22nd Nov 2019, 9:09 PM
sneeze
sneeze - avatar