如何从命令行停止/启动AVG防病毒保护

时间:2012-08-16 09:09:53

标签: windows batch-file command-line antivirus

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

1 个答案:

答案 0 :(得分: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,因为它比批处理更强大,更灵活。