Azure devops Azure cli运行批处理Azure devops错误

Azure devops Azure cli运行批处理Azure devops错误,azure-devops,azure-cli,Azure Devops,Azure Cli,我在使用多行azure cli时遇到此错误。单个命令可以正常工作 The term 'call' is not recognized as the name of a cmdlet, function, script file, or operable program. Check... 我刚刚创建了一个新版本并复制了该行为。实际上,您在脚本类型字段中选择了Powershell。将其更改为批处理,它将按预期工作 编辑 我想我还应该分享如何从您的repo运行批处理脚本,并且不必担心开发人员在每一

我在使用多行azure cli时遇到此错误。单个命令可以正常工作

The term 'call' is not recognized as the name of a cmdlet, function, script file, or operable program. Check...

我刚刚创建了一个新版本并复制了该行为。实际上,您在
脚本类型
字段中选择了
Powershell
。将其更改为批处理,它将按预期工作

编辑

我想我还应该分享如何从您的repo运行批处理脚本,并且不必担心开发人员在每一行的开头都有
call
语句。我只是在我的构建中有一个标准化脚本,它在发布工件之前注入
call

$Deploy_File = Get-Item "Azure-Commands.cmd"
$Deploy_File_Script = $Deploy_File | Get-Content

$Deploy_File_Script_Mod = @()

##Standardise commands for Azure CLI Deployment task
# Loop through Commands
foreach ($Command in $Deploy_File_Script) {
    #Insert "CALL" before each azure command
    if ($Command -like "az *") {
        $Command = "call " + $Command
    }

    # Build Modified script array
    $Deploy_File_Script_Mod += "$Command"
}

#Save to file
$Deploy_File | Set-Content -Value $Deploy_File_Script_Mod

#Output modified commands in file
$Deploy_File | Get-Content

现在您可以从上面的任务调用标准化部署文件了

我刚刚创建了一个新版本并复制了该行为。实际上,您在
脚本类型
字段中选择了
Powershell
。将其更改为批处理,它将按预期工作

编辑

我想我还应该分享如何从您的repo运行批处理脚本,并且不必担心开发人员在每一行的开头都有
call
语句。我只是在我的构建中有一个标准化脚本,它在发布工件之前注入
call

$Deploy_File = Get-Item "Azure-Commands.cmd"
$Deploy_File_Script = $Deploy_File | Get-Content

$Deploy_File_Script_Mod = @()

##Standardise commands for Azure CLI Deployment task
# Loop through Commands
foreach ($Command in $Deploy_File_Script) {
    #Insert "CALL" before each azure command
    if ($Command -like "az *") {
        $Command = "call " + $Command
    }

    # Build Modified script array
    $Deploy_File_Script_Mod += "$Command"
}

#Save to file
$Deploy_File | Set-Content -Value $Deploy_File_Script_Mod

#Output modified commands in file
$Deploy_File | Get-Content

现在您可以从上面的任务调用标准化部署文件了

Hi,如果您像Bevan建议的那样将脚本类型更改为批处理,结果会怎样?请检查他的答案是否有帮助。嗨,如果你像Bevan建议的那样将脚本类型更改为批处理,结果会怎样?请检查他的回答是否有用。