2016-05-18 9 views

答えて

4

したがって、スペースで始まりますか?

# List directories where the name starts with a space 
# Rename them by replacing a space at the start with nothing 
gci -Directory -Recurse -Filter " *" | ren -New {$_.Name.TrimStart()} -WhatIf 

NB。空白のない名前のフォルダがすでに存在する場合は、エラーが発生します。

+2

'$ _。TrimStart()'はOPが動作しやすいかもしれません。 – Matt

+0

@Matt良いアイデア - それを代わりに使うように編集しました。 – TessellatingHeckler

+0

不要なスペースを省略することができます。それは、デフォルトでスペースをトリムします。 – Matt

関連する問題