var currentDir = Directory.GetCurrentDirectory();
var filePath = string.Format("{0}\\Auto.bat", currentDir);
if (File.Exists(filePath))
File.Delete(filePath);

var sourcePath = string.Format("{0}\\ABCD.exe", currentDir);
string autoBat = "@echo off\r\nping -n 2 127.1 >nul\r\ntaskkill /f /im ABCD.Service.exe /im ABCD.exe\r\nstart " + "\"" + "\" " + "\"" + sourcePath + "\"\r\n";
File.WriteAllText(filePath, autoBat, Encoding.Default);

Process p = new Process();
p.StartInfo.FileName = filePath;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.Start();

AutoBat的更多相关文章

  1. ARM-LINUX自动采集温湿度传感器数据

    开机root自动登录 如果想在超级终端输入回车,登录后执行,则可以在/etc/profile中加入命令: 如果实现开机自动登录,在/etc/inittab中修改,每个开发板修改的方式可能都不同. ht ...

  2. 创建一个简单的windows服务,每间隔一定时间重复执行批处理文件

    创建一个windows服务项目,增加App.config <?xml version="1.0" encoding="utf-8" ?> <c ...

随机推荐

  1. C++ thread类多线程编程

    https://blog.csdn.net/dcrmg/article/details/53912941 多线程操作的thread类,简单多线程示例: #include <iostream> ...

  2. 关于asyncio知识(四)

    一.使用 asyncio 总结 最近在公司的一些项目中开始慢慢使用python 的asyncio, 使用的过程中也是各种踩坑,遇到的问题也不少,其中有一次是内存的问题,自己也整理了遇到的问题以及解决方 ...

  3. Atitit s2018 s3 doc list alldvc.docx .docx s2018 s3f doc compc s2018 s3f doc homepc sum doc dvcCompc dtS312 s2018 s3f doc compc\Atitit PathUtil 工具新特性新版本 v8 s312.docx s2018 s3f doc compc\Atitit 操作日

    Atitit s2018 s3 doc list alldvc.docx .docx s2018 s3f doc compc s2018 s3f doc homepc sum doc dvcCompc ...

  4. users-and-groups-in-linux

    https://www.tecmint.com/compress-files-and-finding-files-in-linux/ https://www.tecmint.com/manage-us ...

  5. 如何免费的将本地Web服务映射到外网

    链接地址:https://hongmaju.github.io/2018/05/13/ngrok%E5%B0%86%E6%9C%AC%E5%9C%B0Web%E6%9C%8D%E5%8A%A1%E6% ...

  6. spring gateway 截取response 长度缺失

    网上找到一段获取修改response的代码:https://blog.csdn.net/tianyaleixiaowu/article/details/83618037 代码如下: import or ...

  7. surface shader获取像素深度差值

    void vert (inout appdata_full v, out Input i) { UNITY_INITIALIZE_OUTPUT(Input, i); i.proj = ComputeS ...

  8. rpc error: code = Internal desc = stream terminated by RST_STREAM with error code: PROTOCOL_ERROR

    使用grpc-go调用grpc服务端时,出现rpc error: code = Internal desc = stream terminated by RST_STREAM with error c ...

  9. .NET Core 2.0 获取完整的URL

    在之前的ASP.NET中,可以通过 Request.Url.AbsoluteUri 获取,但在ASP.NET Core没有这个实现,请问如何获取呢? 方法一:先引用“using Microsoft.A ...

  10. Ubuntu下安装Kafka Manager

    参考 : kafka管理器kafka-manager部署安装 下载Kafka Manager,并进行打包,由于Kafka manager是由scala写的,所以需要由sbt的支持 git clone ...