如何在 windows vista 示例中创建服务

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1084496/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 12:46:19  来源:igfitidea点击:

How to create a service in windows vista example

javawindowswindows-services

提问by Nader Shirazie

I am trying to create a new windows vista service through sc utility in command run, from some reason what worked in windows xp doesn't work in vista (surprised?). I am running the following command:

我正在尝试通过命令运行中的 sc 实用程序创建一个新的 windows vista 服务,出于某种原因,在 windows xp 中工作的内容在 vista 中不起作用(感到惊讶?)。我正在运行以下命令:

sc create rmiregistryService binPath ="C:\Program Files\Java\jre1.6.0_05\bin\rmiregistry.exe"

sc 创建 rmiregistryService binPath ="C:\Program Files\Java\jre1.6.0_05\bin\rmiregistry.exe"

and it doesn't work... does anyone have an idea why? Can anyone point me to a working example?

它不起作用......有没有人知道为什么?任何人都可以指出我的工作示例吗?

Thanks, vondip

谢谢,冯迪普

回答by Nader Shirazie

You have a space between binPath and the =

binPath 和 = 之间有一个空格

try sc create rmiregistryService binPath= "C:\Program Files\Java\jre1.6.0_05\bin\rmiregistry.exe"instead

尝试sc create rmiregistryService binPath= "C:\Program Files\Java\jre1.6.0_05\bin\rmiregistry.exe"代替

Also, make sure you're running as administrator

另外,请确保您以管理员身份运行

回答by Scott Coldwell

To get the quote at the beginning of the executable, I had to escape it with "\"like so:

要获得可执行文件开头的引用,我必须"\"像这样转义它:

sc create rmiregistryService binPath= "\"C:\Program Files\Java\jre1.6.0_05\bin\rmiregistry.exe"

回答by Scott Coldwell

This could be because of Security restictions of Vista.

这可能是因为 Vista 的安全限制。

Run This Path on Run Window

在运行窗口上运行此路径

Control Panel\User Accounts and Family Safety\User Accounts

控制面板\用户帐户和家庭安全\用户帐户

Turn User Account Control on or off

打开或关闭用户帐户控制

Turn Off This Function

关闭此功能

Good Luck

祝你好运