본문 바로가기

IT TIP/DOS

Dos Batch..file Read.Line... change Text...For Loop...

Dos..Batch 로 파일 읽어서  명령실행가능한 배치파일 생성 후 실행하는 방법...

 

 

리스트 파일 예시

/projectHome/src/main/java/com/tsy/admin/controller/UserConController.java
/projectHome/src/main/resources/sql/mybatis/oracle/common/mapper-mybatis-user.xml
/projectHome/src/main/webapp/WEB-INF/jsp/admin/userCustPopupList.jsp
/projectHome/src/main/java/com/tsy/admin/service/impl/UserConServiceImpl.java
/projectHome/src/main/webapp/WEB-INF/jsp/admin/userConDetail.jsp

 /trunk/src/main/resources/sql/mybatis/oracle/manufacturing/mapper-mybatis-pi-wi.xml
 /trunk/src/main/java/com/tsy/common/service/impl/CommonServiceImpl.java
 /trunk/src/main/java/com/tsy/manufacturing/dao/PiWiListDao.java
 /trunk/src/main/java/com/tsy/manufacturing/data/PiWiListVo.java
 /trunk/src/main/java/com/tsy/manufacturing/controller/PiWListController.java
 /trunk/src/main/java/com/tsy/manufacturing/data/PiWiSearchVo.java
 /trunk/src/main/java/com/tsy/manufacturing/service/impl/MgmtMailServiceImpl.java

 

 

 

 

 

실제 수행 배치

 

@echo off setlocal REM ============================================== REM 2018.01.30 YTS REM PROD 배포용 파일 copy 작업. REM ============================================== SET TODAY_DATE=%date:~0,4%%date:~5,2%%date:~8,2% SET TODAY_TIME=%time:~0,2%%time:~3,2%%time:~6,2% SET "FILE_ORG=Deploy.list.txt" SET "FILE_NEW=Deploy.%TODAY_DATE%.bat" SET "FILE_HIS=Deploy.%TODAY_DATE%.log" SET "DIR_ORG_T=/trunk/" SET "DIR_ORG_F=/projectHome/" SET "DIR_ORG_S= " SET "DIR_NEW=/" SET "PATH_ORG=/" SET "PATH_NEW=\" SET DIR_FROM=.\..\srcSource SET DIR_TO=.\..\srcTarget ECHO ======================================== >> %FILE_HIS% ECHO %TODAY_DATE% %TODAY_TIME% >> %FILE_HIS% ECHO ---------------------------------------- >> %FILE_HIS% ECHO DIR_FROM : %DIR_FROM% >> %FILE_HIS% ECHO DIR_TO : %DIR_TO% >> %FILE_HIS% ECHO ======================================== >> %FILE_HIS% ECHO ======================================== ECHO %TODAY_DATE% %TODAY_TIME% ECHO ---------------------------------------- ECHO PROD 배포용 파일 copy 작업. ECHO ECHO ======================================== (for /f "delims=" %%i in ('findstr "^" "%FILE_ORG%"') do ( REM (for /f "delims=" %%i in ('findstr /n "^" "%FILE_ORG%"') do ( set "line=%%i" setlocal enabledelayedexpansion REM 1. /trunk/ => / set "line=!line:%DIR_ORG_T%=%DIR_NEW%!" REM 2. /foundry/ => / set "line=!line:%DIR_ORG_F%=%DIR_NEW%!" REM 3. ' ' => '' set "line=!line:%DIR_ORG_S%=!" REM 4. / => \ set "line=!line:%PATH_ORG%=%PATH_NEW%!" echo XCOPY /Y "%DIR_FROM%!line!" "%DIR_TO%!line!" endlocal ))>"%FILE_NEW%" TYPE "%FILE_NEW%" >> %FILE_HIS% ECHO ------------------------------------------------------- TYPE "%FILE_NEW%" ECHO ------------------------------------------------------- ECHO 작업용 Script 는 %FILE_HIS% 에 ADD ... ECHO 생성된 BAT파일 "%FILE_NEW%" 실행합니다~!! ECHO ------------------------------------------------------- PAUSE CALL "%FILE_NEW%" PAUSE DEL "%FILE_NEW%"

 

 

 

 

 

 

 

 

 

 

 

 

dddddd

 

 

 

.................

......

 

 

 

 

 

 

'IT TIP > DOS' 카테고리의 다른 글

shutdown 명령어  (0) 2017.04.02