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.
nileshtdhone
Jul 25, 2024Copper Contributor
sdtslmn test node and agent node are different nodes.
sdtslmn
Jul 25, 2024Brass Contributor
so ensure that the Azure Pipeline agent has the necessary network and file share access to the test node's shared folder.
then we can update the CmdLine Task accordingly
# Your pipeline YAML file
stages:
- stage: Test
jobs:
- job: RunBatchFile
pool:
vmImage: 'windows-latest' # Or specify your agent pool
steps:
- task: CmdLine@2
inputs:
script: |
net use \\<test-node-name>\<shared-folder-path> /user:<YourUsername> <YourPassword>
call \\<test-node-name>\<shared-folder-path>\<your-batch-file>.bat
net use \\<test-node-name>\<shared-folder-path> /delete