我有以下代码来捕获和处理Run命令输出.如何修改它以使"运行"命令窗口显示输出并同时记录输出?@SW_HIDE用@SW_SHOW(或等效的)替换只显示一个空白的命令窗口.
类似于linux tee命令的东西,它在打印STDOUT时记录到文件.
$CurrentPID = Run(@ComSpec & ' /c ' & $CurrentLogCmd, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
If Not ProcessWaitClose($CurrentPID,60) Then
WriteLog("[Warning] Timed-out.Finding date in current hour raw log -" & $CurrentLogFileName)
$F_LogWarningExist = 1
Return $C_SUCCESS ; Take chances and proceed with parsing raw logs
EndIf
$CurrentOutput = StdoutRead($CurrentPID)
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用此处文档页面中*提到的任何主机密钥(通配符)选项打开会话...但是,此操作无法按预期工作。
...在特殊情况下,当不需要安全性时,您可以使用值*接受任何主机密钥。在这种情况下,脚本输出和日志文件将包含有关不安全连接的警告...
日志:
C:\Users\s.mailappan>"C:\Program Files (x86)\WinSCP\WinSCP.com" /console /comman
d "open ssamperf:ssperf123@111.252.2.13 -hostkey=*" "option batch on" "lcd C:\Us
ers\s.mailappan\Documents\Samsung-Sprint\Hourly-Alarm-Logs" "get /home/ssamperf/
PerlScript/Akron_WSS_HOURLYALARMREPORT/LOGS/Akron_WSS1_HOURLYALARMREPORT_NEW.txt
" "get /home/ssamperf/PerlScript/Chicago_WSS_HOURLYALARMREPORT/LOGS/Chicago_WS
S1_HOURLYALARMREPORT_NEW.txt " "exit"
Searching for host...
Connecting to host...
Authenticating...
The server's host key was not found in the cache. You have no guarantee that the
server is the computer you think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 38:b4:75:23:2d:d5:70:2c:ad:c0:d0:e2:9d:2d:72:9e
If you trust this host, press Yes. To connect without …Run Code Online (Sandbox Code Playgroud) 寻找相当于选择最新/最新文件的WinSCP命令行.有任何想法吗
需要匹配BSC0到BSC10和"TOTAL".但是以下条件仅匹配BSC1和BSC10.少了什么东西?尝试过各种s/regex/ m/regex/变化
$currentRowHeader 将包含没有空格的单个单词
if ($currentRowHeader =~ /BSC[0-10]|TOTAL/) { print "OK"}
Run Code Online (Sandbox Code Playgroud) 尝试基于此将给定时间从一个时区转换为另一个时区.但输出是错误的.尝试了不同的价值但没有运气.什么帮助什么失踪?
use Date::Manip::DM6;
use DateTime::Format::DateManip;
my $date2 = '2015-03-24 06:00:00';
$date1 = DateTime::Format::DateManip->parse_datetime( $date2);
my $newdate= UnixDate(Date_ConvTZ($date1 , 'EST', 'PST' ),"%Y-%m-%d %T");
print "date is $date1 and newdate is $newdate";
Run Code Online (Sandbox Code Playgroud)
E:> perl test.pl
日期是2015-03-24T06:00:00,newdate是2015-03-23 12:00:00
预期结果是newdate => 2015-03-24 03:00:00
perl ×2
winscp ×2
autoit ×1
automation ×1
batch-file ×1
regex ×1
ssh-keys ×1
stdout ×1
timezone ×1