【发布时间】:2017-09-11 22:27:37
【问题描述】:
我正在尝试自动化 VSTS 构建代理设置 (https://www.visualstudio.com/en-us/docs/build/actions/agents/v2-windows)。
但是,此过程中有一个交互式步骤。这是一个需要用户输入的 cmd 脚本文件。我尝试使用设置生成一个 TXT 文件,并运行从该文件读取输入的脚本:
.\config < settings.txt
但它不起作用。我收到了这条消息:
Enter server URL > Enter authentication type (press enter for PAT) > Enter perso
nal access token > Cannot read keys when either application does not have a cons
ole or when console input has been redirected. Try Console.Read.
是否可以通过脚本设置构建代理?有没有办法以这种config.cmd 完美工作的方式“重定向”控制台输入?
【问题讨论】:
-
您只需配置一次代理以供将来使用。无论是在交互窗口中手动配置还是在配置开始时通过添加选项(如 thom 所说的 url、pat、pool、agent 等)自动配置,它们都可以工作。而自动配置只能节省几秒或几分钟。
标签: powershell azure-pipelines windows-scripting