• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

使用一个程序同时启动多个程序(c#)

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
宿舍的肥仔每次开机就需要运行多个程序,他希望一个程序实现这些事情,所以写了个程序,大家有什么意见可以给我提出来,我会多加修改,谢谢,贴上源码:
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 懒人程序
{
    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();
        }
    }
}
使用说明:先安装好软件,20多K吧,运行前先在c盘根目录建立一个a.txt,然后把需要同时运行的程序详细路径,包括程序名和exe后缀,一个程序占一行,可以同时有多行,例如:
C:\Program Files\Internet Explorer\iexplore.exe
C:\Program Files\Internet Explorer\iexplore.exe

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
【C语言】指针发布时间:2022-07-14
下一篇:
分分钟用上C#中的委托和事件发布时间:2022-07-13
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap