Set Output Variable in Azure CLI task on VSTS

前端 未结 4 1491
终归单人心
终归单人心 2020-12-07 01:48

I am getting crazy to achieve this very simple task. I need to set an Output Variable in an Azure CLI task on Visual Studio Team Services, because next task in the Release d

4条回答
  •  执念已碎
    2020-12-07 02:28

    Refer to this code below:

    call {your command}>tmpFile1
    set /p myvar= < tmpFile1 
    echo "##vso[task.setvariable variable=testvar;]%myvar%"
    

    or

    FOR /F "tokens=* USEBACKQ" %%F IN (`{your command}`) DO (
    SET var=%%F
    )
    echo "##vso[task.setvariable variable=testvar;]%var%"
    

    Mechaflash's answer in How to set commands output as a variable in a batch file

提交回复
热议问题