批处理文件,用于将文件夹和文件复制到指定时间的多个目录中

时间:2012-11-19 08:51:03

标签: batch-file command-prompt

...的批处理文件

显示: 输入网站名称:例如web或test(路径应与它们相关联,即c:/ inetpub / test或c:/ inetpub / website)

输入您想要的份数...例如20(最多100)

功能: 它会将一个目录(作为名称指定的测试或网站)复制到具有子文件夹和文件(在多个文件夹中)的另一个目录。 文件夹名称1..2..3..4..5..6 ...... 99..100(路径例如c:/ inetpub / wwwroot / test / 1和/ 2和/ 3 .. .C:/的Inetpub / wwwroot的/测试/ 100)

*并按指定时间将网站添加到iis中......

1 个答案:

答案 0 :(得分:0)

主目录和目标目录的数据不足,如果需要可以进行一些更改:

@Echo OFF

:Name_menu
Set /P "Name=Enter the site name >>"
IF NOT DEFINED NAME (Set "Name=" & GOTO:Name_menu)

:Rounds_menu
Set /P "Rounds=Enter number of copies you want (Max 100)>>"
IF NOT DEFINED ROUNDS (Set "Rounds=Name" & GOTO:Rounds_menu)
If %ROUNDS% GTR 99    (Set "Rounds="     & GOTO:Rounds_menu)


:: I've assumed:
:: home dir is the script's dir
:: a folder with the name of the gived website name exists in home dir.
:: you want destiny dir to be "c:\inetpub\wwwroot\" 
FOR /L %%# in (0,1,%ROUNDS%) DO (
MKDIR "c:\inetpub\wwwroot\%NAME%\%%#" >NUL
XCOPY /E /Y ".\%NAME%\*" "c:\inetpub\wwwroot\%NAME%\%%#\"
)

:: About "And adding sites into iis as specified times ..."
:: I don't know IIS and what you want, sorry.

Pause&Exit