title: How to update path in Windows container for Docker?
body: <p>I am trying to update the path inside my container. I have been everywhere and checked out <a href="https://stackoverflow.com/questions/42092932/appending-to-path-in-a-windows-docker-container">several</a> threads on this and <a href="https://forums.docker.com/t/cannot-update-path-variable-in-a-windows-docker-container/30960" rel="nofollow noreferrer">nothing works</a>. So, that's the trick?</p>
  
  <pre><code>
  # escape=`
  ARG SDK_VERSION=4.8
  
  FROM mcr.microsoft.com/dotnet/framework/sdk:${SDK_VERSION}
  
  ENV NODE_VERSION=8.11.2
  
  HEALTHCHECK NONE
  
  RUN Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object 
  System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  
  USER ContainerAdministrator
  
  RUN setx /M PATH "%PATH%;C:/Foo/bin"
  
  USER ContainerUser
  
  SHELL ["cmd", "/S", "/C"]
  
  CMD ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
  </code></pre>
  
  <p>This is the error:</p>
  
  <pre><code>PS C:\users\cbongiorno\source&gt; docker build -t mercury:latest -m 4GB -f Dockerfile i18n-tools
  Sending build context to Docker daemon  2.057MB
  Step 1/10 : ARG SDK_VERSION=4.8
  Step 2/10 : FROM mcr.microsoft.com/dotnet/framework/sdk:${SDK_VERSION}
   ---&gt; 4a9d58026a2d
  Step 7/10 : RUN setx /M PATH "%PATH%;C:/Foo/bin"
   ---&gt; Running in 1caf9e758af2
  
  SUCCESS: Specified value was saved.
  C:/Foo/bin : The term 'C:/Foo/bin' 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:96
  + ... ogressPreference = 'SilentlyContinue'; setx /M PATH %PATH%;C:/Foo/bin
  +                                                                ~~~~~~~~~~
      + CategoryInfo          : ObjectNotFound: (C:/Foo/bin:String) [], ParentCo
     ntainsErrorRecordException
      + FullyQualifiedErrorId : CommandNotFoundException
  
  The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; setx /M PATH "%PATH%;C:/Foo/bin"' returned a non-zero code: 1
  
  </code></pre>