首页 > 其他 > 详细

命令行启动软件

时间:2016-08-26 13:50:34      阅读:194      评论:0      收藏:0      [点我收藏+]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace run3
{
    class Program
    {
        static void Main(string[] args)
        {

            if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Desktop)+"\\run.ini")) {
                Console.WriteLine("no run.ini");
                return;
            }
            if (args.Length == 0) return;
            StreamReader sw = File.OpenText(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\run.ini");
            String temp = "-";
            String all = "";
            
            while ((temp = sw.ReadLine()) != null)
            {
                if (temp == "") continue;
                if (args[0] == temp.Split(new String[] { "=" }, StringSplitOptions.RemoveEmptyEntries)[0])
                {
                    try
                    {

                        Process.Start(temp.Split(new String[] { "=" }, StringSplitOptions.RemoveEmptyEntries)[1]);
                    }
                    catch(Win32Exception e)
                    {

                    }


                    
                }
                

            }

            sw.Close();










        }
    }
}

  

命令行启动软件

原文:http://www.cnblogs.com/aliblogs/p/5809869.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!