2012-11-19 70 views
2

为...批处理文件

显示一个批处理文件: 输入站点名称:例如web或测试(路径应与它们相关联,即c:/ inetpub/test或c:/ inetpub /网站)

输入你想要的副本数量。 20(最大100)

功能: 它会复制一个目录(如名称指定的测试或网站)与子文件夹和文件按规定的时间到另一个(在多个文件夹).. 与文件夹名1 .. 2..3..4..5..6 ...... 99..100(路径例如c:/ inetpub/wwwroot/test/1和/ 2和/3...c:/inetpub/ wwwroot文件/测试/ 100)

*并添加网站到IIS作为指定的时间...

+0

我试图将这些文件夹复制到某个目的地并将站点添加到iis ..在单独的批处理文件 – user1835169

+0

中,正如我想的那样,它只是具有动态源和目标路径的复制命令循环,不是吗? – Raptor

+0

是的..还有一件事,那些文件与输入数字..ie在1到100之间..和文件夹名称,即测试或网站......在简单的我们想要复制的文件夹,在哪里和多少times ... – user1835169

回答

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 
+0

hello,看到这一行“XCOPY/E/Y”。\%NAME%\ *“”c:\ inetpub \ wwwroot \%NAME%\ %%#\“”表示:“XCOPY/E/Y“CurrentDir \ website_name_folder \ ALL(所有文件夹,子文件夹和文件)”“c:\ inetpub \ wwwroot \ website_name_folder \ number \”你确定不复制文件吗?也许我做了一个错字,告诉我更多 – ElektroStudios

+0

实际上,所有的工作都是通过我们的脚本来完成的..我已经手动添加了文件夹的路径..而不是XCOPY/E/Y。\%NAME%\ *“”c:\ inetpub \ wwwroot \%NAME%\ %%#\“我已经使用了XCOPY/E/Y”mypath \%NAME%\ *“”c:\ inetpub \ wwwroot \%NAME%\ %%#\“ ...关于IIS是微软的网络服务器......感谢您的宝贵时间和帮助..节省了我的时间...... :) – user1835169

+0

感谢您的支持道德帮助... – user1835169