结合计划任务每天从Symantec官网下载离线病毒库

#三种方法,由初级到高级

$numbers
= 1..40 | Foreach {"{0:D3}" -f $_} #将数字类型格式化并转换为字符串类型使用-f字符串操作符 ForEach ($number in $numbers) { $Source = 'http://definitions.symantec.com/defs/' + ((Get-Date -Format yyyyMMdd) - 1) + '-' + $number + '-v5i32.exe' $Destination = "F:\" + ((Get-Date -Format yyyyMMdd) - 1) + "-" + $number + ".exe" Invoke-WebRequest -uri $Source -OutFile $Destination } $webreq = Invoke-WebRequest http://www.symantec.com/security_response/definitions/download/detail.jsp?gid=savce $webreq.Content | Out-File C:\output.txt -Force $txt = (Get-Content -Path C:\output.txt -TotalCount 924)[-1] $src = $txt.Substring(59,59) $des = "c:\" + $txt.Substring(96,22) Invoke-WebRequest -uri $src -OutFile $des $webreq = Invoke-WebRequest http://www.symantec.com/security_response/definitions/download/detail.jsp?gid=savce $gc = $webreq.Content $src = [regex]::Matches("$gc",'http://definitions.symantec.com/defs/.{0,20}\.exe') | Foreach-object {$_.value} #正则表达式 $des = "c:\" + $src[0].substring(37,22) Invoke-WebRequest -uri $src[0] -OutFile $des

 

转载于:https://www.cnblogs.com/IvanChen/p/4488260.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值