1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
CD "D:\Symantec\Scan Engine\CmdLineScanner\"
Write-Host "开始扫描以a打头的文件!"
Get-ChildItem -path z:\ | where { $_ .Name -match "^a" } | select fullname | Out-File files.txt #获取以a开头的文件及文件夹,输出到a.txt文件中
$file = Get-Content "files.txt" #将files.txt 内容赋给$file
$file -replace "(?m)\s" ," " > files.txt #删除a.txt文件中的空格
$file = Get-Content " files.txt "
$file = $file[3..$file.count] | Out-File files.txt #删除文件中的前三行描述信息,输出的内容覆盖a.txt文件内容 $file = Get-Content " files.txt "
foreach ($check in $file) { $check = "" "$check"" " #给轮循的内容加上双引号
cmd /c ssecls.exe -server 127.0.0.1:1344 -mode scan -recurse -api 1 -exclude exclude.lst -log a%DATE%.log $check >> a%DATE%-result.log
Write-Host $check " 扫描完毕 "
} write-host " 以a打头的文件扫描完毕!"
|
本文转自bard_zhang51CTO博客,原文链接:http://blog.51cto.com/timefiles/1855343 ,如需转载请自行联系原作者