本帖最后由 Nsqs 于 2023-8-31 08:12 编辑
- $source=@'
- 000 001
- 002
- '@
-
- 0..999|%{$diff='{0:d3}' -f $_;if(!($source -match '{0:d3}' -f $diff)){[PSCustomObject]@{缺少=$diff}}}
复制代码 来段PowerShell的解法
bat:- @echo off
- set "file=1.txt"
- powershell -noprofile -executionpolicy bypass "$source=gc %file%;0..999|%%{$diff='{0:d3}' -f $_;if(!($source -match '{0:d3}' -f $diff)){[PSCustomObject]@{缺少=$diff}}}">b.txt
复制代码
|