windows run .ps1 scripts (powershell)
Powershell is installed in window systems in default.
run in 'cmd'
powershell -command xxx.ps1
Solution: running this command before the script also solves the issue:
set-executionpolicy unrestricted
Solution: execute "cmd" by administrator or run in "window powershell"
Run "powershell -command xxx.ps1"
Solution:
run "powershell -command .\xxx.ps1"
Success!.
Note:
Please, filenames or folders do not start with number like this, it will cannot be executed by powershell.
foreach($f in gci VPN-NonVPN-20180629 *.pcap) { 0_Tool\SplitCap_2-1\SplitCap -p 100000 -b 100000 -r $f.FullName -o 2_Session\AllLayers\$($f.BaseName)-ALL # 0_Tool\SplitCap_2-1\SplitCap -p 100000 -b 100000 -r $f.FullName -s flow -o 2_Session\AllLayers\$($f.BaseName)-ALL gci 2_Session\AllLayers\$($f.BaseName)-ALL | ?{$_.Length -eq 0} | del 0_Tool\SplitCap_2-1\SplitCap -p 100000 -b 100000 -r $f.FullName -o 2_Session\L7\$($f.BaseName)-L7 -y L7 # 0_Tool\SplitCap_2-1\SplitCap -p 100000 -b 100000 -r $f.FullName -s flow -o 2_Session\L7\$($f.BaseName)-L7 -y L7 gci 2_Session\L7\$($f.BaseName)-L7 | ?{$_.Length -eq 0} | del } 0_Tool\finddupe -del 2_Session\AllLayers 0_Tool\finddupe -del 2_Session\L7
Solution: rename the filenames.
"0_Tool" -> "Tool"
posted on 2018-09-21 22:11 Quinn-Yann 阅读(400) 评论(0) 编辑 收藏 举报