# Dockerfile appending PATH environment variable not working?

I think this is just simple and really googling around does give a lot of answers but not sure why it's not working for me.

Firstly without any `ENV PATH =` set, I can check that the `PATH` has a default value of

I check that by simply running the image and use `CMD echo %PATH%`.

However with the following setting, all the default is gone letting the new value alone (looks really like that it cannot get the default value or simply that value is empty):

``````ENV PATH = "C:\Program Files\dotnet\:\${PATH}"
``````

Here are various attempts (not working):

``````#this even tries removing spaces around the =
#like some ones warned that could break the PATH
ENV PATH="C:\Program Files\dotnet:\${PATH}"
ENV PATH = "C:\Program Files\dotnet\:\$PATH"
ENV PATH = "C:\Program Files\dotnet:\${PATH}"
ENV PATH = "C:\Program Files\dotnet:\$PATH"
ENV PATH = "C:\Program Files\dotnet;\${PATH}"
ENV PATH = "C:\Program Files\dotnet;\$PATH"
ENV PATH = "C:\Program Files\dotnet;\$env:PATH"
``````

With one of the above setting, the PATH (checked by `echo %PATH%` when executing cmd on a running container) becomes just `C:\Program Files\dotnet` (maybe with some more characters appended for some cases).

Really I would like to bang my head against the wall for such a simple issue but has taken me hours. Really?

And here is the full dockerfile:

``````# escape=`

FROM microsoft/dotnet:2.1-sdk-nanoserver-1803 AS dotnet

FROM microsoft/dotnet-framework:4.7.2-runtime-windowsservercore-1803

ENV DOTNET_PATH="C:\Program Files\dotnet"
COPY --from=dotnet \${DOTNET_PATH} \${DOTNET_PATH}

ENV PATH = "C:\Program Files\dotnet\:\${PATH}"

ENV ASPNETCORE_URLS=http://+:80 `

DOTNET_RUNNING_IN_CONTAINERS=true `

DOTNET_SKIP_FIRST_TIME_EXPERIENCE="true"
``````

I hope someone here could point out what's wrong. Thanks!

`RUN setx /M PATH "C:\Program Files\dotnet;%PATH%"`