본문 바로가기
C#(CSharp)/Etc

Visual Studio에서 windows command batch 사용하기

by swconsulting 2015. 3. 17.

Visaul Studio에서 빌드 후에 매번 특정 파일을 빌드후 특정 폴더 (data) 에 특정 파일(예를 들어 XML 파일)을 복사해야 하는 경우가 있다.

이럴 경우 아래 처럼 윈도우 command를 이용하면 좋다 


SET mypath="$(OutDir)\Data"

echo %mypath%

SET binPath="$(TargetDir)Data"

echo %binPath%


echo "$(SolutionDir)Data\stickyNoteConfig.xml"

 

if not exist binPath (

 mkdir "Data"

copy "$(SolutionDir)Data\stickyNoteConfig.xml" "Data\stickyNoteConfig.xml"



위 배치 파일을 Post-build event command line: 에 넣어서 사용하면 된다.

출처 : 다년간의 프로그래밍 경험