再提供一种思路,借powershell用正则来匹配- #&cls&powershell "iex(gc '%~0'|out-string)"&pause&exit\b
- $txt="C:\Users\lenovo\Desktop\nums.txt"
- $nums=@()
- gc $txt|%{$nums+=$_.split(",")[1]}
- $line=$nums -join "#"
- $pattern="([0-4]#|-\d+#){3}([7-9]#|[1-9]\d+#){3}(-[7-9]#|-[1-9]\d+#){3}"
- $check=[regex]::matches($line,$pattern).value
- ($check -split "#"|?{$_ -ne ""})[-1]
复制代码
|