把应用程序设置成winodws服务的命令如下
sc create FileMonitorService type= own start= auto binpath= E:learn_projectWindowsService1FileMonitorServiceinDebugFileMonitorService.exe displayname= FileMonitorService
然后到服务里启动这个服务就可以了