0

我正在编写一个需要停止然后在中间启动 AVG 防病毒保护的批处理脚本。有没有办法只使用命令行来做到这一点?

4

1 回答 1

1

好的 - 我想你想要看起来像这样的东西。它不是防弹的,但它应该让你开始。

Set myshell = WScript.CreateObject("WScript.Shell")
Dim cmd

REM Do your pre-AVG-stop commands here

REM Now stop AVG using the 'taskkill' command.  Note that this command assumes 
REM that the name of the process is "avgscanx".  You should verify that is true.
REM You also may need to play around with the parameters for 'taskkill'.  Run
REM 'taskkilll /?' in a cmd window to see the various options.  You may also want
REM to add some code to verify that taskkill was successful.

taskkill /IM "avgscanx"

REM Do your post-AVG-stop commands here.

REM Now, let's restart AVG.
REM Modify the command line below for your specific use of AVG.
REM And, again, you may want to add some code to verify that AVG started.

cmd = """avgscanx"" /parameter1 /parameter2 /etc"
myshell.Run(cmd,0,true)

最后一点。您可能需要考虑切换到 PowerShell,因为它比批处理功能更强大、更灵活。

于 2012-08-17T17:39:11.253 回答