xxx.ps1 用法自查- $text = (gc '.\sys.txt') -join "`r`n";
- $sys = [regex]::Matches($text, "(?ism)(?:partition_index.*?file_name[^`r`n]+)").value;
- $roms = (ls|?{!$_.PSIsContainor -and $_.Name -Like 'ROM*'});
-
- for($i=0; $i -lt $sys.count; $i++){
- if($roms.Length -gt $i){
- $newname = [regex]::Match($sys[$i],'(?i)(?<=file_name.).*$').value.Trim();
- if($newname -ne ''){Rename-Item $roms[$i].FullName -NewName $newname -Force}
- }
- }
复制代码
|