Why can't I run 2 commands consecutively using batch file for gcloud

后端 未结 2 680
遥遥无期
遥遥无期 2021-01-14 07:13

so I have this .bat file:

@echo off
cd C:\\Users\\user\\Downloads
gcloud auth activate-service-account --key-file=keyFileName.json
gcloud auth p         


        
相关标签:
2条回答
  • 2021-01-14 07:29

    You can also just add CALL before each command, for example:

    CALL gcloud app deploy
    CALL gcloud app describe
    
    0 讨论(0)
  • 2021-01-14 07:30

    When running some gcloud commands, they have the expectation that they may be interacting with a user. In addition, they can adversely interact with the current command line processor (CMD on Windows). This can result in the command line processor ending prematurely. One solution is to run your scripted gcloud commands in their own local / nested instance of a command line processor.

    If today, your script contains:

    gcloud ... some command parameters ...
    

    replace this with:

    cmd /c gcloud ... some command parameters ...
    

    This will cause the gcloud command to run in its own nested environment which won't interfere with the top level (scripted) environment.

    0 讨论(0)
提交回复
热议问题