//指定一个文件名,写入脚本
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+@"temp\fileServer\"+ifexe+@""" """+path+@""" """+path+ifexe+ @""" del %0 ")); // del %0 } ProcessStartInfo info = new ProcessStartInfo(filename); info.WindowStyle = ProcessWindowStyle.Hidden; Process.Start(info); Environment.Exit(0);
c# 软件自动升级 程序自我关闭自己后重启,布布扣,bubuko.com
原文:http://www.cnblogs.com/pigddyou/p/3716694.html