本帖最后由 Nsqs 于 2023-9-6 00:31 编辑
- # >nul&cls&powershell -noprofile -executionpolicy bypass "gc '%~f0'|out-string|iex" & exit
- function re([Parameter(ValueFromPipeline)]$str,$old,$new){
- $old=$old.ToCharArray();$new=$new.ToCharArray()
- 0..$old.count|%{$str=$str.replace($old[$_],$new[$_])};$str
- }
- dir *.jpg,*.png -File|?{$_ -match '[()]'}|%{ren $_ ($_.Name|re -old '()' -new '()')}
复制代码
|