综合

img 00x0

SCRIPT:使用Windows Script 关闭和打开指定程序

发表于2004/10/14 21:37:00  884人阅读

--------------关闭指定程序----------
<job >
<script language="VBScript">


logip="127.0.0.1"      //计算机标识
user=""                      //用户名
password=""             //密码
APPname="qq.exe"  //指定欲关闭的程序名
namespace="root/cimv2"


wScript.Echo "STRAT"

set wmiLocator = CreateObject ("WbemScripting.SWbemLocator")   
set objwmi = wmiLocator.ConnectServer (logip, namespace, user, password)

 


set col =objwmi.execquery ("select * from Win32_Process where Name='"+APPname+"'")

for each colin in col
colin.terminate()

next
wScript.Echo "END"
</script>
</job>
----------------------------------------------运行指定程序----------------


<job >
<script language="VBScript">

logip="127.0.0.1"      //计算机标识
user=""                      //用户名
password=""             //密码

APPname="qq.exe"  //指定欲启动的程序名

namespace="root/cimv2"


wScript.Echo "STRAT"

 

 


set wmiLocator = CreateObject ("WbemScripting.SWbemLocator")   
set objwmi = wmiLocator.ConnectServer (logip, namespace, user, password)

 

'或
'set processClass = GetObject ("winmgmts:Win32_Process")
'retVal = processClass.Create (APPname)

set OBJ=objwmi.InstancesOf ("Win32_Proces")


OBJ.Create (APPname)

 

 

wScript.Echo "END"
</script>
</job>

阅读全文
0 0

相关文章推荐

img
取 消
img