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


宿舍的肥仔每次开机就需要运行多个程序,他希望一个程序实现这些事情,所以写了个程序,大家有什么意见可以给我提出来,我会多加修改,谢谢,贴上源码:
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

本文出自 “waster” 博客,请务必保留此出处http://waster.blog.51cto.com/117583/82629

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/jiangfenggong/archive/2008/09/14/2809785.aspx

转载于:https://www.cnblogs.com/aqi0530/archive/2010/08/26/1809283.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值