Use a program to start multiple programs at the same time (C #)
Source: Internet
Author: User
The fat boy in the dormitory needs to run multiple Program He wanted a program to implement these things, so he wrote a program. Could you give me any comments? I will make more modifications. Thank you and paste the source code:
Using system;
Using system. Collections. Generic;
Using system. componentmodel;
Using system. Data;
Using system. drawing;
Using system. text;
Using system. Windows. forms;
Using system. diagnostics;
Using system. IO;
Namespace lazy Program
{
Public partial class form1: Form
{
Public form1 ()
{
Initializecomponent ();
}
Private void form1_load (Object sender, eventargs E)
{
System. Diagnostics. processstartinfo info = new system. Diagnostics. processstartinfo ();
Info. useshellexecute = true;
Process P;
String Path = @ "C: \ a.txt ";
Filestream FS = new filestream (path, filemode. Open, fileaccess. Read );
Streamreader sr = new streamreader (FS, encoding. Default );
String RL;
While (RL = Sr. Readline ())! = NULL)
{
Info. filename = RL;
// Richtextbox1.appendtext (RL + '\ n ');
P = process. Start (Info );
}
Sr. Close ();
FS. Close ();
Application. Exit ();
}
}
}
Instructions for use: install the software first, and create a.txt file in the C-root directory before running. Then, take the detailed path of the program to be run simultaneously, including the program name and exe suffix, and one program occupies one line. Multiple lines can exist at the same time. For example:
C: \ Program Files \ Internet Explorer \ ipolice.exe
C: \ Program Files \ Internet Explorer \ ipolice.exe
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.