- @cd /d %~dp0 & powershell -command "Get-Content '%~0' | Select-Object -Skip 1 | Out-String | Invoke-Expression" & pause & exit/b
-
- Get-ChildItem -Path . -Directory | ForEach-Object {
- $fName = $_.Name
- Push-Location $_
- $i = 0
- Get-ChildItem -Path . -File | Sort-Object {
- ( $_.BaseName -replace "${fName}-(\d+).*","`$1" ) -as [int]
- } | ForEach-Object {
- $i++
- $NameNew = "${fName}-$i" + ( $_.BaseName -replace "${fName}-(\d+)","" ) + $_.Extension
- $_.Name + " " + $NameNew
- #Rename-Item $_ -NewName $NameNew
- }
- Pop-Location
- }
复制代码 回复 4# liaoguinan |