2014-02-07 5 views
0

Jenkins의 환경 변수를 나중에 Mac에서 환경 변수를 설정하는 데 사용하는 파일로 유지해야합니다. 나는 다음과 같은 배치 명령의 내용은 cmd를 윈도우에서와 마찬가지로 작동합니다 가정 : 그것은 다음과 같은 생산하고Jenkins의 환경 변수를 Windows 배치에서 어떻게 유지합니까?

set | find "PROCESSOR" 

젠킨스 내에서 실행할 때 cmd.exe를에서

NUMBER_OF_PROCESSORS=2 
PROCESSOR_ARCHITECTURE=x86 
PROCESSOR_IDENTIFIER=x86 Family 6 Model 44 Stepping 2, GenuineIntel 
PROCESSOR_LEVEL=6 
PROCESSOR_REVISION=2c02 

를 생성

C:\jenkins\workspace\P_PIL\ManageEnvironment>set | find "PROCESSOR" 
find: unable to access "PROCESSOR": The system cannot find the file specified. 
The process tried to write to a nonexistent pipe. 
The process tried to write to a nonexistent pipe. 
The process tried to write to a nonexistent pipe. 
The process tried to write to a nonexistent pipe. 
The process tried to write to a nonexistent pipe. 
The process tried to write to a nonexistent pipe. 
The process tried to write to a nonexistent pipe. 
The process tried to write to a nonexistent pipe. 
The process tried to write to a nonexistent pipe. 
The process tried to write to a nonexistent pipe. 
The process tried to write to a nonexistent pipe. 
The process tried to write to a nonexistent pipe. 
The process tried to write to a nonexistent pipe. 

C:\jenkins\workspace\P_PIL\ManageEnvironment>exit 1 

나는 POWERSHELL에서 멀어지고 싶지만 그게 유일한 방법 일 경우 시도해 볼 수 있다고 생각합니다. Jenkins 내 명령 줄에서 배치 명령까지의 동작 차이를 이해할 수 없습니다.

+1

Jenkins 환경에서 'find'가 사용중인 것과 동일한 것이 확실합니까? 사용자가 사용하는 경로는 Jenkins 계정에서 사용되는 경로와 다를 수 있습니다. 경로가 무엇인지 에코하기 위해 배치 파일을 변경하고'C : \ windows \ system32 '이전에 나타나는 경로에 다른 find가 있는지 확인하십시오. 아니면 C : \ windows \ system32 \ find.exe를 명시 적으로 호출하면됩니다. – Mark

+0

어. 감사. 당신이 올바른지. Jenkins가 사용한 것과 다른 사용자로서 명령 줄에서 작업을 수행하고있었습니다. Jenkins 사용자는 경로 상에 유닉스 유틸리티를 가지고 있었고 유닉스 스타일의 찾기 기능을 사용하고있었습니다. 아래에 제안 된대로 findstr을 사용하여 분명한 것으로 선택했습니다. –

답변

2

나는 find가 실제로 "PROCESS"를 파일로 취급하려고한다고 말할 수 있습니다. 나는 set의 출력이 다음 오류 메시지와 일치하는 올바르게 파이프되지 않았기 때문이라고 생각합니다. 이는 대상 파이프가 닫혀 있기 때문입니다. 나는 find 명령의 동작과 관련이 있다고 생각합니다. 대신 findstr을 사용해보십시오.

관련 문제