プレフィックスと連結するとドキュメントのタイトルを与える増分 6 桁の値と組み合わせて事前に提供されたプレフィックスを使用して、フォルダー内のファイルの名前を変更するスクリプトを作成しています。
提供されたフォルダーからファイルリストを反復処理し、最初に提供された番号が最初の増分であるたびに増分番号を増分するプレフィックスで各ファイル名を変更するスクリプトが必要です。
私は近くにいますが、いくつかのエラーが発生しており、どこが間違っているのかわかりません。お知らせ下さい。
Write-host "Please enter prefix:"
[String]$strPrefix = read-host
Write-host "Please enter incrimental value:"
[int]$intInc = read-host
Write-host "Please enter Files folder:"
[String]$strFiles = "C:\scripts\files"
#$items = Get-ChildItem -Path $strFiles
$items = $strFiles
$intInc
#for each file in $strFiles
foreach ($file in $items )
{
$newName = $strPrefix + ('0' * (6 - $intInc.ToSTring().Length)) + ($intInc++).ToString()
if ($extOnly.length -eq 0)
{
Rename-Item New-Name{$file -replace '$newName'}
}
else
{
Write-host "NewName $newName$extOnly"
Rename-Item New-Name{$file -replace '$newName$extOnly'}
} #end else
$file
}#end for
私は近くにいると思いますが、何かが倒れているだけです