• 使用一个程序同时启动多个程序(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
  • 相关阅读:
    flutter sdk版本升级或者降级到指定版本
    flutter upgrage到1.17版本 android打包报错 Could not determine the dependencies of task ':app:lintVitalRelease'.
    小程序 自定义alert弹窗 带动画
    小程序 自定义cell 自定义group
    小程序 自定义弹窗禁止底部内容滚动 textarea内容上移
    css fixed 强制居中
    小程序 正则表达式
    小程序 自定义导航栏
    小程序 swiper自定义dot
    java 中锁的分类
  • 原文地址:https://www.cnblogs.com/hsapphire/p/1977003.html
Copyright © 2020-2023  润新知