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打头的文件扫描完毕!"