c# 软件自动升级 程序自我关闭自己后重启

               //指定一个文件名,写入脚本
string filename = Path.Combine(path,"killmyself.bat"); using (StreamWriter bat = new StreamWriter(filename, false, Encoding.GetEncoding("GB2312"))) { //删除指定程序,复制指定程序到指定路径 bat.WriteLine(string.Format(@" @echo off del "+ifexe+@" copy /y """+path+@"tempfileServer"+ifexe+@""" """+path+@""" """+path+ifexe+ @""" del %0 ")); // del %0 } ProcessStartInfo info = new ProcessStartInfo(filename); info.WindowStyle = ProcessWindowStyle.Hidden; Process.Start(info); Environment.Exit(0);
原文地址:https://www.cnblogs.com/pigddyou/p/3716694.html