如何从Windows服务打开cmd? [英] How to open cmd from windows service?

查看:134
本文介绍了如何从Windows服务打开cmd?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建windowsservice并使用C#。我想从windows服务打开cmd / .exe文件。我的操作系统是windows8.Does它可以从Windows服务吗?或任何替代方案。我想要打开cmd / exe之后一些间隔,这就是我选择Windows服务的原因。

解决方案

如果您的应用程序没有窗口或其他用户界面,那么您应该可以这样做 - 一个应用程序例如,它只是将值存储在数据库中,并且关闭将是f

虽然有(或者,我没有尝试过)hacky方法,但是:在32位和64位架构中转发Vista UAC [ ^ ]但如果它在win 7/8/10中有效,那么不要指望它继续工作! :笑:


 Logger.SetLogWriter( new  LogWriterFactory()。Create(),< span class =code-keyword> true ); 

Console.WriteLine( 已启动批处理作业);


I am creating windowsservice and using C#.I want open cmd/.exe file from windows service.My operating system is windows8.Does it possible from windows service?or any alternative for that.I want want open cmd/exe after some interval that's why I choosed windows service.

解决方案

Provided your application has no window, or other user interface at all then you should be able to do it - an app which just stores values in a a DB for example and shuts would be f
There are (or were, I haven't tried) hacky methods to do it though: Subverting Vista UAC in Both 32 and 64 bit Architectures[^] but if it works in win 7 / 8 / 10, then don't expect it to remain working! :laugh:


Logger.SetLogWriter(new LogWriterFactory().Create(), true);

                Console.WriteLine("Started batch job");


这篇关于如何从Windows服务打开cmd?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆