我有一个 Windows Elastic Beanstalk 实例。commands.config
我的项目中有以下内容.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%\chocolatey\bin
这两个命令正在工作。但是,我也有一个container-commands.config
文件需要调用choco
,但由于'choco' is not recognized as an internal or external command
container_commands:
01-install nssm:
command: |
choco install nssm -y
如何获取后续命令以获取更新的PATH
? 是否有更合适的方法来安装二进制文件并将它们设置为PATH
在 ESB 实例创建期间的窗口?
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
但即使这样也给了我类似的错误。
-----------------------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.
------------------------------------------------------------