PowerShell和LOGPARSER参数 [英] Powershell and logparser arguments

查看:221
本文介绍了PowerShell和LOGPARSER参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着去运行PowerShell的命令LOGPARSER但有问题,与我的脚本传递的参数正确对面,继承人的excert进出口;

Im trying to run some logparser commands from powershell but Im having issues with passing the arguments across correctly, heres the excert from my script;

D:\\脚本\\ smtplogs \\ LOGPARSER \\ logparser.exeSELECT TOP 50接收机,COUNT()INTO%TMPOutput%\\为preceiversNDRALL.gif从%TEMPDIR%\\ PostAll.log WHERE发件人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:接收器所有%DateGraph%NULL消息

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%"

香港专业教育学院读到封装参数加载,但不能似乎想出如何使这项工作!

Ive read loads about encapsulating arguments but cant seem to figure out how to make this work!

任何帮助,你们可以提供将是非常美联社preciated。

Any help that you guys could provide would be very appreciated.

感谢

推荐答案

对于一个复杂的字符串参数,请尝试使用PowerShell中的这里弦,这样你就不必担心逃逸单/双引号

For a complex string parameter, try to pass the argument using powershell here-strings so that you wouldn't have to worry about escaping single/double quotes

UPDATE1 :我不能让fomratting所以在这里工作的是屏幕截图。

UPDATE1: I couldn't get the fomratting working so here is the screenshot.

UPDATE2 :我能够最终格式化code

UPDATE2: I was able to format the code finally.


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%
"@

请确保您添加一个新行此处的字符串绰号之间的 @@

Make sure that you add a new line between the here-string monikers @" and "@.

这篇关于PowerShell和LOGPARSER参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆