我正在尝试从Power Shell的容器内部运行可执行文件,并收到一条找不到该错误消息的错误消息。但是,我已经确认它的目录在Path中,并且可执行文件在我期望的位置。我想念什么?
PS C:\docker_work> IarBuild.exe
IarBuild.exe : The term 'IarBuild.exe' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ IarBuild.exe
+ ~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (IarBuild.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\docker_work> $Env:Path
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\
OpenSSH\;C:\Users\ContainerAdministrator\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\IAR Systems\Embedded
Workbench 8.1\common\bin"
PS C:\docker_work> ls 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.1\common\bin\IarBuild.exe'
Directory: C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.1\common\bin
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 9/1/2018 4:09 AM 724992 IarBuild.exe
PS C:\docker_work>
我的docker文件包含以下内容:
...
# Add the IAR common\bin\ folder to the image's PATH
RUN setx path \
"%path%;C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.1\common\bin\"
...
CMD [ "powershell.exe", "-executionpolicy" , "Unrestricted" ]
[您将需要添加。\,因此它看起来像。\ IarBuild.exe,因为它当前正在尝试将.exe作为cmdlet处理