考慮包含以下文件的目錄結構中的反覆調用Windows批處理文件:對其他批處理文件
\1.3\Baseline\GeneratedScripts\One\FullInstall.cmd
\1.3\Baseline\GeneratedScripts\Two\FullInstall.cmd
\1.3\Baseline\GeneratedScripts\Three\FullInstall.cmd
\1.3\Patches\Patch1\GeneratedScripts\One\FullInstall.cmd
\1.3\Patches\Patch1\GeneratedScripts\Two\FullInstall.cmd
\1.3\Patches\Patch1\GeneratedScripts\Three\FullInstall.cmd
\1.3\Patches\Patch2\GeneratedScripts\One\FullInstall.cmd
\1.3\Patches\Patch2\GeneratedScripts\Two\FullInstall.cmd
\1.3\Patches\Patch2\GeneratedScripts\Three\FullInstall.cmd
\1.3\Patches\Patch3\GeneratedScripts\One\FullInstall.cmd
\1.3\Patches\Patch3\GeneratedScripts\Two\FullInstall.cmd
\1.3\Patches\Patch3\GeneratedScripts\Three\FullInstall.cmd
我想建立一個Windows批處理文件InstallEnvironment.cmd
其中:
- 取一個環境名稱作爲參數;然後
- 依次執行基準安裝腳本和每個修補程序腳本。
該批處理文件應自動執行後面添加的任何附加修補程序。
從本質上講,我需要做沿着此線的東西:
for %%_ in (1.3\**\GeneratedScripts\%%1\FullInstall.cmd) do cal %%_
但是我不知道通配符系統豐富,足以讓這個,因爲我沒有得到任何匹配的**
目錄通配符。
例如,與參數「兩個」需要執行下面的腳本調用,依次是:
\1.3\Baseline\GeneratedScripts\Two\FullInstall.cmd
\1.3\Patches\Patch1\GeneratedScripts\Two\FullInstall.cmd
\1.3\Patches\Patch2\GeneratedScripts\Two\FullInstall.cmd
\1.3\Patches\Patch3\GeneratedScripts\Two\FullInstall.cmd
啊太棒了。閱讀「for」文檔時,我錯過了「/ r」開關。 – 2009-05-06 16:13:21