使用Java启动,停止Windows服务 [英] Start,Stop Windows Service using Javascript

查看:87
本文介绍了使用Java启动,停止Windows服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
谁能告诉我如何使用javascript启动和停止Windows服务.

感谢

Hello,
Can anyone plz tell me how to start and stop windows service using javascript.

thanks

推荐答案

此线程 [<一个href ="http://www.codingforums.com/showthread.php?t=69156" target ="_ blank" title ="New Window"> ^ ]应该可以帮助您.
This thread[^] should help you out.


创建一个.bat文件并在其中写入以下命令以启动窗口服务

净停止打印后台处理程序"(您想要的服务名称)

现在使用javascript运行.bat文件

Create a .bat file and write following command in it to start window service

net stop "Print Spooler" (service name you want)

and now use javascript to run .bat file

function runBat()
{
   var str = "c:\test.bat";
   WshShell = new ActiveXObject("WScript.Shell");
   WshShell.Run (str,1,true);

}



要运行javascript功能,需要配置浏览器安全性,以允许运行ActiveXObject.



to run above javascript function, your browser security needs to be configured, to allow run ActiveXObject.


这篇关于使用Java启动,停止Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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