保存为bat文件,放在主目录下执行 | @Powershell "& {[ScriptBlock]::Create("'#' + ([io.file]::ReadAllText('%~f0',[text.encoding]::Default))").Invoke()}" & pause & exit | | | | $list_txt = '名单.txt'; | | | | | | if(-not [IO.Directory]::Exists('输出')) { md '输出'|Out-Null } | | | | | | | | | | $text = type $list_txt -ReadCount 0; | | $count = $text.Count; | | $counter=0; | | $len = [string]$count.Length | | $ErrorActionPreference = 'silentlycontinue' | | foreach($line in $text) | | { | | $dir_name = "输出\{0:yyyyMMdd}-{1:d$len}-{2}" -f [datetime]::Now,++$counter,$line; | | | | if(-not [IO.Directory]::Exists($dir_name)) { md $dir_name|Out-Null } | | if($?) | | { | | md "$dir_name\01-原始资料和身份信息" |Out-Null; | | md "$dir_name\02-债权转让" |Out-Null; | | md "$dir_name\03-立案材料" |Out-Null; | | md "$dir_name\04-签收底单" |Out-Null; | | } | | | | | | foreach($file in (dir "材料\*" -Filter *$line*)) | | { | | move $file "$dir_name\01-原始资料和身份信息" | | } | | | | | | }COPY |
|