0

PowerShell 스크립트를 호출하여 Selenium WebDriver 테스트를 실행하기 위해 Octopus Deploy에 프로세스 단계가 있지만 오류가 발생합니다.Octopus PowerShell 스크립트가 실행되지 않음

set nunitPath="C:\AutomatedTests" 
cd %nunitPath%\ 
nunit-console SiteCore.nunit /include:BulkyWasteTests 

배포가 자리하고 스크립트가 일어나는 실행하는 프로세스 단계를 소요, ​​다음과 같은 오류가 발생합니다 :

Set-Location : Cannot find path 'C:\Octopus\Work\20170110115049-7\%nunitPath%\' because it does not exist. 

At C:\Octopus\Work\20170110115049-7\Script.ps1:2 char:3 

+ cd %nunitPath%\ 

+ CategoryInfo   : ObjectNotFound: (C:\Octopus\Work...-7\%nunitPath %\:String) [Set-Location], ItemNotFoundException 
+ FullyQualifiedErrorId :  PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand 

The remote script failed with exit code 1 

난 몰라 다음과 같이

파워 쉘 스크립트입니다 오류로 인해 PowerShell 스크립트에 지정된 위치와 다른 위치가보고되는 이유를 이해하십시오. 도움을 주시면 감사하겠습니다.

답변

0

cd는 Set-Location의 별칭이므로 오류를보고 변경해야하는 두 번째 줄임을 알 수 있습니다. 귀하의 CD 라인이 위치를 nunitPath 스크립트 변수가 아닌 % nunitpath % 환경 변수로 설정하려고합니다. @ 4c74356b41 추가 올바른 코멘트와 함께 편집

set nunitPath "C:\AutomatedTests" 
cd $nunitpath 
nunit-console SiteCore.nunit /include:BulkyWasteTests 

:

그래서 스크립트가 같아야 스크립트 변수를 사용하여 $의 nunitpath를 참조하십시오.

+0

set은 set-variable의 별칭이므로 powershell에서 작동하지 않습니다. set nunitPath가되어야합니다. C : \ AutomatedTests " – 4c74356b41

+0

스크립트의 구문이 바뀌었지만 여전히 같은 오류가 발생합니다. 서버에서 권한 문제 일 수 있습니까? –

+0

적어도 다른 오류를 게시해야합니까? –

0

문자열의 환경 변수 참조를 확장하는 데 PowerShell에서 %variablename% 구문을 사용하지 않습니다. 그것은 cmd.exe 구문입니다. PowerShell에서 대신 $env:variablename을 작성하십시오.

+0

답변 해 주셔서 감사합니다. –