2011-11-14 10 views
3

私はスペースをアンダースコアに置き換え、また、PowerShellを使用して、それらからconstant_を削除することができますどのようにこの形式大量のファイルの名前変更 - PowerShellの

constant_blah_blah_blah.png 

とフォルダ内の多くのファイルがありますか?

ありがとうございます。

+0

申し訳ありませんが、私は何をしようとしていません。私はPowerShellのしくみを知らない。 – Tsarl

+0

ここ、Google、および/またはMSDNのPowerShellのドキュメントを参照して検索してください。 –

答えて

6

あなたはこの

Get-childItem constant* | % {rename-item $_.name ($_.name -replace '_',' ')} 
Get-childItem constant* | % {rename-item $_.name ($_.name -replace 'constant ','')} 
+0

これは2つの名前を変更しますが、必要ではありません(私の答えを見てください)。 – Joey

5
# gather all files that match the criteria 
Get-ChildItem constant_* | 
    ForEach-Object { 
     # remove the "constant_" from the beginning and replace _ by space. 
     Rename-Item $_ ($_.Name -replace '^constant_' -replace '_', ' ') 
    } 

か短いを試すことができます。

ls constant_* | %{rni $_ ($_.Name -replace '^constant_' -replace '_', ' ')} 
+0

+1とフィルタリングと展開のls /%。 –

関連する問題