sitelink1 | |
---|---|
sitelink2 | |
sitelink3 |
커맨드 명령어를 실행하는 함수
private void executeCommand(String[] command) throws IOException, InterruptedException {
System.out.println("명령어>>");
for (int i = 0; i < command.length; i++) {
System.out.print(command[i]);
}
System.out.println();
Process p = Runtime.getRuntime().exec(command);
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream(), "ms949"));
String line = null;
StringBuffer lineSb = new StringBuffer();
while ((line = br.readLine()) != null) {
lineSb.append(line);
}
if (lineSb.length() > 0) {
System.out.println(lineSb); // 실행 결과를 출력
}
lineSb = null;
line = null;
br.close();
br = null;
if (!p.waitFor(3, TimeUnit.SECONDS)) {
System.out.println("Destroy");
p.destroy();
}
command = null;
p = null;
}
커맨드 실행함수를 콜하는 코드
String[] command = new String[] {
"\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\tf.exe\" workfold \""+branch+"\" /unmap /collection:\"https://[tfs도메인]:[tfs포트]/tfs/[팀프로젝트]/\" /workspace:\"[workspace이름]\" /login:\"[아이디,비번]\"" };
this.executeCommand(command);
command = new String[] {
"\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\tf.exe\" workfold \""+branch+"\" \"D:\\WORK\\\" /collection:\"https://[tfs도메인]:[tfs포트]/tfs/[팀프로젝트]/\" /workspace:\"[workspace이름]\" /login:\"[아이디,비번]\"" };
this.executeCommand(command);
command = new String[] {
"\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\tf.exe\" get \"D:\\WORK\\\" /overwrite /force /recursive /version:C" + [변경집합] + " /login:\"[아이디,비번]\"" };
this.executeCommand(command);
프로그램을 실행하려는 PC의 작업영역을 손봐야 한다
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
14 | [도움말 캡쳐] tf.exe git help | 황제낙엽 | 2021.07.26 | 272 |
13 | [도움말 캡쳐] tf.exe workspace [1] | 황제낙엽 | 2020.10.22 | 256 |
12 | tf vc get 실행시 /force /overwrite 모두 사용해도 "모든 파일이 최신 상태입니다." 라고만 나온다 | 황제낙엽 | 2020.10.16 | 576 |
11 | tf vc workfold 지정후 get 으로 다운로드시 유의사항 | 황제낙엽 | 2020.10.16 | 220 |
10 | tf vc dir 예제 | 황제낙엽 | 2020.10.15 | 235 |
9 | tf vc get 명령어에 대한 이해 | 황제낙엽 | 2020.10.15 | 204 |
8 | workfold 목록 조회 예제 | 황제낙엽 | 2020.10.15 | 248 |
» | Java 에서 tf.exe를 이용하여 tfs에 접속하여 브랜치와 변경집합으로 소스를 다운로드하는 예제 | 황제낙엽 | 2020.08.12 | 217 |
6 | [도움말 캡쳐] tf.exe get | 황제낙엽 | 2020.05.22 | 255 |
5 | 작업영역(workspaces) 목록 조회 명령어 (Microsoft Visual Studio 2017) | 황제낙엽 | 2020.05.22 | 255 |
4 | [도움말 캡쳐] tf.exe workspaces | 황제낙엽 | 2020.05.22 | 227 |
3 | [도움말 캡쳐] tf.exe workfold | 황제낙엽 | 2020.05.22 | 275 |
2 | [도움말 캡쳐] tf.exe /? | 황제낙엽 | 2020.05.22 | 253 |
1 | TFS 에서 Workspace 삭제 (TF.exe) | 황제낙엽 | 2018.06.04 | 509 |