我试着从运行PowerShell的命令LOGPARSER但与横穿正确的论点,继承人从我的脚本excert问题IM;
d:\脚本\ smtplogs\LOGPARSER\logparser.exe"SELECT TOP 50的接收机,COUNT()INTO%TMPOutput%\ TopReceiversNDRALL.gif FROM%TEMPDIR%\ PostAll.log WHERE发件人LIKE '<>'和接收机NOT LIKE"% %去-fmtopper %%" GROUP BY接收机ORDER BY COUNT()DESC" -i:TSV -iSeparator:空间-headerRow:OFF -iHeaderFile: "header3.tsv" -lineFilter: "+ 10".-o:图表-chartType:ColumnClustered -config:MyScript.js -chartTitle: "接收器NULL所有邮件的%DateGraph%"
我已阅读有关封装参数的负载,但似乎无法弄清楚如何使这项工作!
你们可以提供的任何帮助都将非常感激.
谢谢
对于复杂的字符串参数,尝试使用powershell here-strings传递参数,这样您就不必担心转义单引号/双引号
更新1:我无法得到工作,所以这里是截图.
UPDATE2:我最终能够格式化代码.
d:\scripting\smtplogs\logparser\logparser.exe @" SELECT TOP 50 Receiver, COUNT() INTO %TMPOutput%\TopReceiversNDRALL.gif FROM %TempDir%\PostAll.log WHERE Sender LIKE '' AND Receiver NOT LIKE '%%go-fmtopper%%' GROUP BY Receiver ORDER BY COUNT() DESC" -i:TSV -iSeparator:space -headerRow:OFF -iHeaderFile:"header3.tsv" -lineFilter:"+10." -o:CHART -chartType:ColumnClustered -config:MyScript.js -chartTitle:"Receivers for NULL messages ALL for %DateGraph% "@
确保在here-string monikers @"和"@之间添加一个新行.