Env variable not taking correctly inside windows container- tried different ways

but when i target only nuget in docker file like below it is working

FROM mcr.microsoft.com/windows/servercore:ltsc2019
WORKDIR /scripts
 
COPY Nuget/nuget.exe C:/nuget/nuget.exe
 
ENV PATH="C:/nuget;${PATH}"
 
RUN nuget install Newtonsoft.Json -OutputDirectory C:/nuget/packages

and when I use like below in the existing docker file it is failing with error

# --- NuGet: Copy and PATH setup ---
COPY Nuget/nuget.exe C:/nuget/nuget.exe
ENV PATH="C:/nuget;${PATH}"
# (Optional: Diagnostic - confirm nuget.exe works, remove after confirming stable builds)
RUN C:\nuget\nuget.exe help