Closed milbrandt closed 3 years ago
Hi @milbrandt! The task is working as expected; the workingFolder
input is only used to specify the working directory that your batch script will use. It doesn't affect the path to the script. So the fix would be to use:
- task: BatchScript@1
inputs:
workingFolder: '$(SrcDir)'
filename: '$(SrcDir)\builds\setupdevenv.cmd'
arguments: instpkg 3rdpty man
By the way, the workaround with script
works because in the context of $(SrcDir)
the path builds\setupdevenv.cmd
is indeed valid, so both tasks work as expected.
Could you please confirm if the issue is resolved with this fix?
@DaniilShmelev Your solution works. But then the documentation should be more prcise:
filenamePath | (Required) Path of the cmd or bat script to execute. Should be fully qualified path or relative to the default working directory |
---|
The filenamePath in my report was relative to working folder. For me as a non-native English speaker It was not obvious that there is a difference between working folder and working directory.
And different behaviour of the two similar tasks (cross platform script
and BashScript
) is surprising at least for me.
Required Information
Entering this information will route you directly to the right team and expedite traction.
Question, Bug, or Feature?
Type: Bug
Enter Task Name: BatchScript@1
Environment
Server - Azure Pipelines or TFS on-premises? Azure DevOps Server 2020 (Dev18.M170.6)
Agent - Hosted or Private:
Issue Description
When two repos are checked out, the working directory is not taken to execute the script. Instead it is searched in directory
s
.When only one repo is checked out (in directory
src
, the script is running.Workaround: using script task
Task logs
logs_87193.zip
Error logs
`2021-01-22T20:39:58.7047072Z ##[debug]Working directory: 'D:_2\46\src\' 2021-01-22T20:39:58.7048548Z ##[debug]Fail on standard error: 'True' 2021-01-22T20:39:58.7049408Z ##[debug]Modify environment: 'False' 2021-01-22T20:39:58.7049862Z ##[debug]C:\Windows\system32\cmd.exe /c "D:_2\46\s\builds\setupdevenv.cmd instpkg 3rdpty" 2021-01-22T20:39:58.7051039Z ##[command]D:_2\46\s\builds\setupdevenv.cmd instpkg 3rdpty 2021-01-22T20:39:58.7101778Z ##[error]The system cannot find the path specified.
2021-01-22T20:39:58.7247451Z ##[error]Process completed with exit code 1 and had 1 error(s) written to the error stream. 2021-01-22T20:39:58.7250783Z ##[debug]System.Exception: Process completed with exit code 1 and had 1 error(s) written to the error stream. at Microsoft.VisualStudio.Services.Agent.Worker.Handlers.ProcessHandler.RunAsync() at Microsoft.VisualStudio.Services.Agent.Worker.TaskRunner.RunAsync() at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.RunStepAsync(IStep step, CancellationToken jobCancellationToken) 2021-01-22T20:39:58.7253475Z ##[section]Finishing: Setup`