Add executable to Windows PATH from .ebextensions and then call executable in subsequent commandIs there an equivalent of 'which' on the Windows command line?How do I measure execution time of a command on the Windows command line?Setting Windows PowerShell environment variablesList all environment variables from command line?How do I run two commands in one line in Windows CMD?Why is PowerShell “not recognized” when installing Chocolatey?Can't run iex in Windows command prompt or git bashAWS Elastic Beanstalk ebextension not executing shell script to use npm installHow to run or install tool on hosted agent in VSTS

Composing fill in the blanks

Can a US President, after impeachment and removal, be re-elected or re-appointed?

What would the United Kingdom's "optimal" Brexit deal look like?

Should I let a company know I've reverse engineered and rebuilt their app?

Employer stores plain text personal data in a 'data warehouse'

Why put copper in between battery contacts and clamps?

Why are we moving in circles with a tandem kayak?

How can Paypal know my card is being used in another account?

Why is the Apollo LEM ladder so far from the ground?

Self-deportation of American Citizens from US

Rampant sharing of authorship among colleagues in the name of "collaboration". Is not taking part in it a death knell for a future in academia?

How to store my pliers and wire cutters on my desk?

Wrapping IMemoryCache with SemaphoreSlim

Should I accept an invitation to give a talk from someone who might review my proposal?

Struggling with cyclical dependencies in unit tests

How to have poached eggs in "sphere form"?

8086 stack segment and avoiding overflow in interrupts

Is SecureRandom.ints() secure?

Desktop app status bar: Notification vs error message

Scam? Checks via Email

If you inherit a Roth 401(k), is it taxed?

How can chaotic entities be prevented from spreading beyond their domain?

Assuring luggage isn't lost with short layover

What are the cons of stateless password generators?



Add executable to Windows PATH from .ebextensions and then call executable in subsequent command


Is there an equivalent of 'which' on the Windows command line?How do I measure execution time of a command on the Windows command line?Setting Windows PowerShell environment variablesList all environment variables from command line?How do I run two commands in one line in Windows CMD?Why is PowerShell “not recognized” when installing Chocolatey?Can't run iex in Windows command prompt or git bashAWS Elastic Beanstalk ebextension not executing shell script to use npm installHow to run or install tool on hosted agent in VSTS






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I have a Windows Elastic Beanstalk instance. I have the following commands.config in my project's .ebextensions



commands:
00-install-choco:
command: |
powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"
01-set-choco-path:
command: |
SET PATH=%PATH%;%ALLUSERSPROFILE%chocolateybin


These two commands are working. However, I also have a container-commands.config file which needs to call upon choco, but it keeps failing due to 'choco' is not recognized as an internal or external command



container_commands:
01-install nssm:
command: |
choco install nssm -y


How do I get subsequent commands to pick up the updated PATH? Is there a more appropriate approach to installing binaries and setting them to Window's PATH during ESB instance creation?



I attempted to follow https://aws.amazon.com/blogs/developer/using-nuget-and-chocolatey-package-managers-in-aws-cloudformation-and-aws-elastic-beanstalk/



files:
c:/tools/ewmp.cmd:
content: |
@ECHO OFF
FOR /F "tokens=3,*" %%a IN ('REG QUERY "HKLMSystemCurrentControlSetControlSession ManagerEnvironment" /v PATH') DO PATH %%a%%b
%*
commands:
01-install-choco:
command: powershell -NoProfile -ExecutionPolicy unrestricted -Command "Invoke-Expression ((New-Object Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
waitAfterCompletion: 0
02-install-nssm:
command: c:/tools/ewmp choco install nssm -y
waitAfterCompletion: 0


But even that gives me similar errors.



-----------------------Command Output-----------------------
ERROR: Invalid key name.
Type "REG QUERY /?" for usage.
'choco' is not recognized as an internal or external command,
operable program or batch file.
------------------------------------------------------------









share|improve this question
































    1















    I have a Windows Elastic Beanstalk instance. I have the following commands.config in my project's .ebextensions



    commands:
    00-install-choco:
    command: |
    powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"
    01-set-choco-path:
    command: |
    SET PATH=%PATH%;%ALLUSERSPROFILE%chocolateybin


    These two commands are working. However, I also have a container-commands.config file which needs to call upon choco, but it keeps failing due to 'choco' is not recognized as an internal or external command



    container_commands:
    01-install nssm:
    command: |
    choco install nssm -y


    How do I get subsequent commands to pick up the updated PATH? Is there a more appropriate approach to installing binaries and setting them to Window's PATH during ESB instance creation?



    I attempted to follow https://aws.amazon.com/blogs/developer/using-nuget-and-chocolatey-package-managers-in-aws-cloudformation-and-aws-elastic-beanstalk/



    files:
    c:/tools/ewmp.cmd:
    content: |
    @ECHO OFF
    FOR /F "tokens=3,*" %%a IN ('REG QUERY "HKLMSystemCurrentControlSetControlSession ManagerEnvironment" /v PATH') DO PATH %%a%%b
    %*
    commands:
    01-install-choco:
    command: powershell -NoProfile -ExecutionPolicy unrestricted -Command "Invoke-Expression ((New-Object Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
    waitAfterCompletion: 0
    02-install-nssm:
    command: c:/tools/ewmp choco install nssm -y
    waitAfterCompletion: 0


    But even that gives me similar errors.



    -----------------------Command Output-----------------------
    ERROR: Invalid key name.
    Type "REG QUERY /?" for usage.
    'choco' is not recognized as an internal or external command,
    operable program or batch file.
    ------------------------------------------------------------









    share|improve this question




























      1












      1








      1








      I have a Windows Elastic Beanstalk instance. I have the following commands.config in my project's .ebextensions



      commands:
      00-install-choco:
      command: |
      powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"
      01-set-choco-path:
      command: |
      SET PATH=%PATH%;%ALLUSERSPROFILE%chocolateybin


      These two commands are working. However, I also have a container-commands.config file which needs to call upon choco, but it keeps failing due to 'choco' is not recognized as an internal or external command



      container_commands:
      01-install nssm:
      command: |
      choco install nssm -y


      How do I get subsequent commands to pick up the updated PATH? Is there a more appropriate approach to installing binaries and setting them to Window's PATH during ESB instance creation?



      I attempted to follow https://aws.amazon.com/blogs/developer/using-nuget-and-chocolatey-package-managers-in-aws-cloudformation-and-aws-elastic-beanstalk/



      files:
      c:/tools/ewmp.cmd:
      content: |
      @ECHO OFF
      FOR /F "tokens=3,*" %%a IN ('REG QUERY "HKLMSystemCurrentControlSetControlSession ManagerEnvironment" /v PATH') DO PATH %%a%%b
      %*
      commands:
      01-install-choco:
      command: powershell -NoProfile -ExecutionPolicy unrestricted -Command "Invoke-Expression ((New-Object Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
      waitAfterCompletion: 0
      02-install-nssm:
      command: c:/tools/ewmp choco install nssm -y
      waitAfterCompletion: 0


      But even that gives me similar errors.



      -----------------------Command Output-----------------------
      ERROR: Invalid key name.
      Type "REG QUERY /?" for usage.
      'choco' is not recognized as an internal or external command,
      operable program or batch file.
      ------------------------------------------------------------









      share|improve this question
















      I have a Windows Elastic Beanstalk instance. I have the following commands.config in my project's .ebextensions



      commands:
      00-install-choco:
      command: |
      powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"
      01-set-choco-path:
      command: |
      SET PATH=%PATH%;%ALLUSERSPROFILE%chocolateybin


      These two commands are working. However, I also have a container-commands.config file which needs to call upon choco, but it keeps failing due to 'choco' is not recognized as an internal or external command



      container_commands:
      01-install nssm:
      command: |
      choco install nssm -y


      How do I get subsequent commands to pick up the updated PATH? Is there a more appropriate approach to installing binaries and setting them to Window's PATH during ESB instance creation?



      I attempted to follow https://aws.amazon.com/blogs/developer/using-nuget-and-chocolatey-package-managers-in-aws-cloudformation-and-aws-elastic-beanstalk/



      files:
      c:/tools/ewmp.cmd:
      content: |
      @ECHO OFF
      FOR /F "tokens=3,*" %%a IN ('REG QUERY "HKLMSystemCurrentControlSetControlSession ManagerEnvironment" /v PATH') DO PATH %%a%%b
      %*
      commands:
      01-install-choco:
      command: powershell -NoProfile -ExecutionPolicy unrestricted -Command "Invoke-Expression ((New-Object Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
      waitAfterCompletion: 0
      02-install-nssm:
      command: c:/tools/ewmp choco install nssm -y
      waitAfterCompletion: 0


      But even that gives me similar errors.



      -----------------------Command Output-----------------------
      ERROR: Invalid key name.
      Type "REG QUERY /?" for usage.
      'choco' is not recognized as an internal or external command,
      operable program or batch file.
      ------------------------------------------------------------






      windows amazon-elastic-beanstalk chocolatey ebextensions






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 27 at 15:03







      Cooper

















      asked Mar 26 at 20:22









      CooperCooper

      91211 silver badges27 bronze badges




      91211 silver badges27 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          1














          I am not a user of Elastic Beanstalk, so I can't speak to whether this will work or not, but according to the documentation it is necessary to provide an additional command to update to PATH variable that is used:




          The Chocolatey installer and the packages it installs may modify the machine’s PATH environment variable. This adds complexity since subsequent commands after these installations are executed in the same session, which does not have the updated PATH. To overcome this, we utilize a command file to set the session’s PATH to that of the machine before it executes our command.




          files:
          c:/tools/ewmp.cmd:
          content: |
          @ECHO OFF
          FOR /F "tokens=3,*" %%a IN ('REG QUERY "HKLMSystemCurrentControlSetControlSession ManagerEnvironment" /v PATH') DO PATH %%a%%b
          %*
          commands:
          00-install-choco:
          command: powershell -NoProfile -ExecutionPolicy unrestricted -Command "Invoke-Expression ((New-Object Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
          container_commands:
          01-install nssm:
          command: |
          c:toolsewmp choco install nssm -y


          NOTE: The one thing I am not clear on, based on the documentation, is the usage of c:toolsewmp rather than c:/tools/ewmp in the command section. I don't know if this is an escaping issue in the code that is being rendered to the browser in the documentation, or whether this is intentional. You may need to play with this to see what works.






          share|improve this answer

























          • Even with playing with different usages of ewmp, this still gives me a not recognized error. ERROR: Invalid key name. 'choco' is not recognized as an internal or external command

            – Cooper
            Mar 27 at 15:02












          • But that AWS blog post is a good find! It does explain why the PATH isn't being picked up.

            – Cooper
            Mar 27 at 15:36











          • Did you try the example from the article? Could it be something to do with the container command?

            – Gary Ewan Park
            Mar 27 at 19:32










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55365646%2fadd-executable-to-windows-path-from-ebextensions-and-then-call-executable-in-su%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          I am not a user of Elastic Beanstalk, so I can't speak to whether this will work or not, but according to the documentation it is necessary to provide an additional command to update to PATH variable that is used:




          The Chocolatey installer and the packages it installs may modify the machine’s PATH environment variable. This adds complexity since subsequent commands after these installations are executed in the same session, which does not have the updated PATH. To overcome this, we utilize a command file to set the session’s PATH to that of the machine before it executes our command.




          files:
          c:/tools/ewmp.cmd:
          content: |
          @ECHO OFF
          FOR /F "tokens=3,*" %%a IN ('REG QUERY "HKLMSystemCurrentControlSetControlSession ManagerEnvironment" /v PATH') DO PATH %%a%%b
          %*
          commands:
          00-install-choco:
          command: powershell -NoProfile -ExecutionPolicy unrestricted -Command "Invoke-Expression ((New-Object Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
          container_commands:
          01-install nssm:
          command: |
          c:toolsewmp choco install nssm -y


          NOTE: The one thing I am not clear on, based on the documentation, is the usage of c:toolsewmp rather than c:/tools/ewmp in the command section. I don't know if this is an escaping issue in the code that is being rendered to the browser in the documentation, or whether this is intentional. You may need to play with this to see what works.






          share|improve this answer

























          • Even with playing with different usages of ewmp, this still gives me a not recognized error. ERROR: Invalid key name. 'choco' is not recognized as an internal or external command

            – Cooper
            Mar 27 at 15:02












          • But that AWS blog post is a good find! It does explain why the PATH isn't being picked up.

            – Cooper
            Mar 27 at 15:36











          • Did you try the example from the article? Could it be something to do with the container command?

            – Gary Ewan Park
            Mar 27 at 19:32















          1














          I am not a user of Elastic Beanstalk, so I can't speak to whether this will work or not, but according to the documentation it is necessary to provide an additional command to update to PATH variable that is used:




          The Chocolatey installer and the packages it installs may modify the machine’s PATH environment variable. This adds complexity since subsequent commands after these installations are executed in the same session, which does not have the updated PATH. To overcome this, we utilize a command file to set the session’s PATH to that of the machine before it executes our command.




          files:
          c:/tools/ewmp.cmd:
          content: |
          @ECHO OFF
          FOR /F "tokens=3,*" %%a IN ('REG QUERY "HKLMSystemCurrentControlSetControlSession ManagerEnvironment" /v PATH') DO PATH %%a%%b
          %*
          commands:
          00-install-choco:
          command: powershell -NoProfile -ExecutionPolicy unrestricted -Command "Invoke-Expression ((New-Object Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
          container_commands:
          01-install nssm:
          command: |
          c:toolsewmp choco install nssm -y


          NOTE: The one thing I am not clear on, based on the documentation, is the usage of c:toolsewmp rather than c:/tools/ewmp in the command section. I don't know if this is an escaping issue in the code that is being rendered to the browser in the documentation, or whether this is intentional. You may need to play with this to see what works.






          share|improve this answer

























          • Even with playing with different usages of ewmp, this still gives me a not recognized error. ERROR: Invalid key name. 'choco' is not recognized as an internal or external command

            – Cooper
            Mar 27 at 15:02












          • But that AWS blog post is a good find! It does explain why the PATH isn't being picked up.

            – Cooper
            Mar 27 at 15:36











          • Did you try the example from the article? Could it be something to do with the container command?

            – Gary Ewan Park
            Mar 27 at 19:32













          1












          1








          1







          I am not a user of Elastic Beanstalk, so I can't speak to whether this will work or not, but according to the documentation it is necessary to provide an additional command to update to PATH variable that is used:




          The Chocolatey installer and the packages it installs may modify the machine’s PATH environment variable. This adds complexity since subsequent commands after these installations are executed in the same session, which does not have the updated PATH. To overcome this, we utilize a command file to set the session’s PATH to that of the machine before it executes our command.




          files:
          c:/tools/ewmp.cmd:
          content: |
          @ECHO OFF
          FOR /F "tokens=3,*" %%a IN ('REG QUERY "HKLMSystemCurrentControlSetControlSession ManagerEnvironment" /v PATH') DO PATH %%a%%b
          %*
          commands:
          00-install-choco:
          command: powershell -NoProfile -ExecutionPolicy unrestricted -Command "Invoke-Expression ((New-Object Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
          container_commands:
          01-install nssm:
          command: |
          c:toolsewmp choco install nssm -y


          NOTE: The one thing I am not clear on, based on the documentation, is the usage of c:toolsewmp rather than c:/tools/ewmp in the command section. I don't know if this is an escaping issue in the code that is being rendered to the browser in the documentation, or whether this is intentional. You may need to play with this to see what works.






          share|improve this answer













          I am not a user of Elastic Beanstalk, so I can't speak to whether this will work or not, but according to the documentation it is necessary to provide an additional command to update to PATH variable that is used:




          The Chocolatey installer and the packages it installs may modify the machine’s PATH environment variable. This adds complexity since subsequent commands after these installations are executed in the same session, which does not have the updated PATH. To overcome this, we utilize a command file to set the session’s PATH to that of the machine before it executes our command.




          files:
          c:/tools/ewmp.cmd:
          content: |
          @ECHO OFF
          FOR /F "tokens=3,*" %%a IN ('REG QUERY "HKLMSystemCurrentControlSetControlSession ManagerEnvironment" /v PATH') DO PATH %%a%%b
          %*
          commands:
          00-install-choco:
          command: powershell -NoProfile -ExecutionPolicy unrestricted -Command "Invoke-Expression ((New-Object Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
          container_commands:
          01-install nssm:
          command: |
          c:toolsewmp choco install nssm -y


          NOTE: The one thing I am not clear on, based on the documentation, is the usage of c:toolsewmp rather than c:/tools/ewmp in the command section. I don't know if this is an escaping issue in the code that is being rendered to the browser in the documentation, or whether this is intentional. You may need to play with this to see what works.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 27 at 7:49









          Gary Ewan ParkGary Ewan Park

          8,3074 gold badges20 silver badges46 bronze badges




          8,3074 gold badges20 silver badges46 bronze badges















          • Even with playing with different usages of ewmp, this still gives me a not recognized error. ERROR: Invalid key name. 'choco' is not recognized as an internal or external command

            – Cooper
            Mar 27 at 15:02












          • But that AWS blog post is a good find! It does explain why the PATH isn't being picked up.

            – Cooper
            Mar 27 at 15:36











          • Did you try the example from the article? Could it be something to do with the container command?

            – Gary Ewan Park
            Mar 27 at 19:32

















          • Even with playing with different usages of ewmp, this still gives me a not recognized error. ERROR: Invalid key name. 'choco' is not recognized as an internal or external command

            – Cooper
            Mar 27 at 15:02












          • But that AWS blog post is a good find! It does explain why the PATH isn't being picked up.

            – Cooper
            Mar 27 at 15:36











          • Did you try the example from the article? Could it be something to do with the container command?

            – Gary Ewan Park
            Mar 27 at 19:32
















          Even with playing with different usages of ewmp, this still gives me a not recognized error. ERROR: Invalid key name. 'choco' is not recognized as an internal or external command

          – Cooper
          Mar 27 at 15:02






          Even with playing with different usages of ewmp, this still gives me a not recognized error. ERROR: Invalid key name. 'choco' is not recognized as an internal or external command

          – Cooper
          Mar 27 at 15:02














          But that AWS blog post is a good find! It does explain why the PATH isn't being picked up.

          – Cooper
          Mar 27 at 15:36





          But that AWS blog post is a good find! It does explain why the PATH isn't being picked up.

          – Cooper
          Mar 27 at 15:36













          Did you try the example from the article? Could it be something to do with the container command?

          – Gary Ewan Park
          Mar 27 at 19:32





          Did you try the example from the article? Could it be something to do with the container command?

          – Gary Ewan Park
          Mar 27 at 19:32








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55365646%2fadd-executable-to-windows-path-from-ebextensions-and-then-call-executable-in-su%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

          155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해