1. 程式人生 > >cmd for 循環拷貝文件

cmd for 循環拷貝文件

prop www 環境 sta ack cmd for 循環 ron end

原文:cmd for 循環拷貝文件

這幾天忙活部署測試環境, 中途需要拷貝 文件, 直接貼code吧:

::/定義原路徑
set source=seventrat_test_backend,seventrat_test_frontend
::/定義目標路徑
set target=director1,director2,director3
::/定義文件夾
set folders=All,App_Browsers,bin,Htmls,Images,Properties,Scripts,Styles,Views
for %%s in (%source%) DO (
    for %%t in
(%target%) DO ( for %%f in (%folders%) DO ( ::set sp=%%s%%f xcopy "D:\SevenStar\%%s\%%f\*.*" "D:\SevenStar\%%t\%%s\%%f\" /s /h /d /c /y ) ) ) pause

cmd for 循環拷貝文件