转载-https://www.cnblogs.com/yubao/p/8443455.html Create Windows Service project using Visual Studio Create files on starting and stopping service: using System.IO; protected override void OnStart(string[] args) { File.Create(AppDomain.CurrentDomain.Ba…