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의 작업영역을 손봐야 한다

번호 제목 글쓴이 날짜 조회 수
96 tf vc workfold 지정후 get 으로 다운로드시 유의사항 황제낙엽 2020.10.16 220
95 tf vc dir 예제 황제낙엽 2020.10.15 235
94 tf vc get 명령어에 대한 이해 황제낙엽 2020.10.15 204
93 workfold 목록 조회 예제 황제낙엽 2020.10.15 248
92 Cannot start service TfsJobAgent on computer '<COMPUTERNAME>' file 황제낙엽 2020.09.24 356
91 하나의 PC에서 여럿 계정으로 작업영역을 구성하여 작업하기 황제낙엽 2020.09.01 221
» Java 에서 tf.exe를 이용하여 tfs에 접속하여 브랜치와 변경집합으로 소스를 다운로드하는 예제 황제낙엽 2020.08.12 217
89 [도움말 캡쳐] tf.exe get 황제낙엽 2020.05.22 255
88 작업영역(workspaces) 목록 조회 명령어 (Microsoft Visual Studio 2017) 황제낙엽 2020.05.22 255
87 [도움말 캡쳐] tf.exe workspaces 황제낙엽 2020.05.22 227
86 [도움말 캡쳐] tf.exe workfold 황제낙엽 2020.05.22 275
85 [도움말 캡쳐] tf.exe /? 황제낙엽 2020.05.22 253
84 IIS+SMTP서버, Gmail 을 통한 TFS2010 메일 설정 file 황제낙엽 2020.03.04 344
83 Visual Studio 2017 - witadmin.exe 의 위치 황제낙엽 2020.03.03 630
82 보안 - SSL(HTTPS) 적용 file 황제낙엽 2020.03.02 341
81 TFS 알림 관리 (알림 메일 전송) file 황제낙엽 2020.02.20 309
80 deletefield syntax 황제낙엽 2020.02.19 237
79 TF255049 황제낙엽 2020.02.14 311
78 [witadmin] changefield 황제낙엽 2020.02.05 277
77 전자 메일 알림 설정 file 황제낙엽 2020.02.04 294