|
|
楼主 |
发表于 2021-12-7 11:30:37
|
显示全部楼层
[已解决]批处理文件夹内图片的名字
感谢论坛的@went热心大佬帮忙解决了。- #&@cls&cd /d "%~dp0" & @powershell -c "Get-Content '%~0' | Select-Object -Skip 1 | Out-String | Invoke-Expression" & pause&exit
- Get-ChildItem * | Where-Object { [System.IO.Directory]::Exists($_.FullName) } | foreach {
- $_.FullName
- Get-ChildItem -Path $_.FullName -Filter '*.jpg' | Sort-Object { [int]$_.BaseName } | foreach {
- Move-Item -Path $_.FullName -Destination ('{0}\{1}-{2:000}.jpg' -f $_.Directory.FullName,$_.Directory.BaseName,[int]$_.BaseName)
- }
- }
复制代码 |
|