Forum Discussion
nileshtdhone
Jul 25, 2024Copper Contributor
How to run the batch file in Test node from Azure pipelines.
I have batch file in test node shared folder and wanted to execute through the pipeline.
sdtslmn
Jul 25, 2024MCT
First Ensure that your Azure Pipeline agent is running on the test node itself
Then
Use either the BatchScript task or the CmdLine task
example for BatchScript
# ... your pipeline stages ...
- stage: Test
jobs:
- job: RunBatchFile
pool:
vmImage: 'windows-latest' # Or specify your agent pool that runs on the test node
steps:
- task: BatchScript@1
inputs:
filename: '\\<test-node-name>\<shared-folder-path>\<your-batch-file>.bat' # Replace with the actual path
# arguments: '...' # Optional: Add arguments for your batch file
and
example for CmdLine
# ... your pipeline stages ...
- stage: Test
jobs:
- job: RunBatchFile
pool:
vmImage: 'windows-latest'
steps:
- task: CmdLine@2
inputs:
script: 'call \\<test-node-name>\<shared-folder-path>\<your-batch-file>.bat'
# add any additional arguments to the script if necessary
nileshtdhone
Jul 25, 2024Copper Contributor
sdtslmn test node and agent node are different nodes.