在非VS环境中使用另一个Exe文件安装Windows服务

时间:2012-11-02 07:06:31

标签: visual-studio-2010 windows-services command-prompt

我要求在开发人员环境中开发一个Windows服务。我必须将我的服务安装到我没有安装.Net Framework的Windows Server 2008上。根据这种情况,我选择了另一个将安装Windows服务的EXE文件。

我有一些正常的命令提示符可以使用此命令安装Windows服务。

c:\> sc create binpath = "my service path [EXE]"

但我需要在另一个EXE文件中执行此语句。在这种情况下是否有更好的解决方案。请帮助我。

谢谢,

1 个答案:

答案 0 :(得分:0)

if (the service is developed with .NET) {
    //do nothing and tell you manager that 
    //.net framework needs to be installed on Windows Server 2008
} else {
    //use the sc command or 
    //put the command in a batch file with conent "sc create binpath = "my service path [EXE]"
}