Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

PowerShell 一鍵批量建立資料夾:比 Excel 法更簡單

編輯:Win10 系統基礎知識

需建立大量編碼資料夾(如專案編號、日期序列)?PowerShell 單行指令即可搞定,免用 Excel 輔助。

指令語法

mkdir $(1..10 | %{ "IThome$_" })

參數說明

  • 1..10:編號範圍(可改 11..20、1..100 等)。
  • "IThome$_":前綴字串(可自訂),$_ 代表管道傳入的編號。

操作步驟

  1. 開啟 PowerShell(無需管理員權限)。
  2. cd 至目標目錄(或建完再移動)。
  3. 貼上指令按 Enter,瞬間完成。

注意

複製貼上時特殊字元(引號、括號)可能編碼錯誤,建議手動輸入或確認字元無誤再執行。

Copyright © Windows教程網 All Rights Reserved