我正在做一些Windows批处理文件“编程”,以使用AWS CodeDeploy注册应用程序修订。
以下是我目前在批处理文件中的内容:
@echo off
aws --region us-east-1 --endpoint-url https://codedeploy.us-east-1.amazonaws.com deploy push --application-name MyApp1 --s3-location s3://s3-codeDevel-MyApp1.zip --source .\ --description "Application Revision Pushed from Tst"
当我运行命令时:
aws --region us-east-1 --endpoint-url https://codedeploy.us-east-1.amazonaws.com deploy push --application-name MyApp1 --s3-location s3://s3-codeDevel-MyApp1 --source .\ --description "Application Revision Pushed from Tst"
...本身,上面命令中的输出显示在命令提示符中:
To deploy with this revision, run:
aws deploy create-deployment --application-name MyApp1 --s3-location bucket=s3-codeDevel-MyApp1,key=MyApp1.zip,bundleType=zip,eTag=f4f28724b951fdeeee61d57c24ceba99 --deployment-group-name <deployment-group-name> --deployment-config-name <deployment-config-name> --description <description>
我想在批处理文件中运行另一个命令,该命令解析并在下一个命令中使用上面的输出,因为“eTag”的值发生了变化。
在一天结束时,这就是我希望我的批处理文件的样子:
@echo off
aws --region us-east-1 --endpoint-url https://codedeploy.us-east-1.amazonaws.com deploy push --application-name MyApp1 --s3-location s3://s3-codeDevel-MyApp1.zip --source .\ --description "Application Revision Pushed from Tst"
aws deploy create-deployment --application-name MyApp1 --s3-location bucket=s3-codeDevel-MyApp1,key=MyApp1.zip,bundleType=zip,eTag=<Parsed from previous command> --deployment-group-name DeploymentGroup --deployment-config-name DeploymentConfigName --description "My Description"
我将如何完成这项工作?
答案 0 :(得分:0)
@echo off
set "command=aws --region us-east-1 --endpoint-url https://codedeploy.us-east-1.amazonaws.com deploy push --application-name MyApp1 --s3-location s3://s3-codeDevel-MyApp1 --source .\ --description "Application Revision Pushed from Tst""
for /f "delims=" %%a in ('%command%') do set "line=%%a"
set "line=%line:*eTag=%"
for /f "delims== " %%a in ("%line%") do set "key=%%a"
echo Debug: Key=%key%
aws deploy create-deployment --application-name MyApp1 --s3-location bucket=s3-codeDevel-MyApp1,key=MyApp1.zip,bundleType=zip,eTag=%key% --deployment-group-name DeploymentGroup --deployment-config-name DeploymentConfigName --description "My Description"
之前删除所有内容
- 从“休息”中获取第一个单词
- 使用该值执行命令
<jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
<jaxws:enableWrapperStyle>true</jaxws:enableWrapperStyle>
<jaxws:enableAsyncMapping>false</jaxws:enableAsyncMapping>
</jaxws:bindings>