Re: [問題] 批次修改資料夾名稱

看板Windows作者 (falken)時間2年前 (2022/04/17 04:05), 2年前編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/7 (看更多)
Function Main { Create-MultipleFolders -Title "X" -Amount 999 } Function Create-MultipleFolders { param ( [string]$Path = '', [string]$Title = '', [int]$Amount = 1) if ($Path.Length -eq 0) {$Path = $pwd.path} for ([int]$i = 1; $i -le $Amount; $i++) { [string]$TitleWithNumber = '{0}{1:d3}' -f $Title, $i [string]$TargetFullName = $Path.Trim().Trim('\') + '\' + $TitleWithNumber New-Item -Force -ItemType 'directory' -Path ( $TargetFullName -replace '([\`\[\]])', '`$1') } } Main https://i.imgur.com/BvkQu5Z.png
-- Sent from PTTopia -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 110.28.6.173 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Windows/M.1650139503.A.0AD.html ※ 編輯: falcon (110.28.6.173 臺灣), 04/17/2022 04:08:02 ※ 編輯: falcon (110.28.6.173 臺灣), 04/17/2022 04:13:23 ※ 編輯: falcon (110.28.6.173 臺灣), 04/17/2022 04:14:54 ※ 編輯: falcon (110.28.6.173 臺灣), 04/17/2022 04:18:49
文章代碼(AID): #1YMo5l2j (Windows)
討論串 (同標題文章)
文章代碼(AID): #1YMo5l2j (Windows)