Rewriting the batch files into powershell

Okay I have also another topic I rewrite on the side the batchfiles which are part of pytroch helper files in powershell because:
1.Microsoft want to drop the support for batchfiles(since MS-DOS) at some point in time at least they said so.
2. Duplicate sections inside not sure what going on
3.I can check if accepted files and environment variables are there and valid.

My problems is I can reproduce what those lines do :

echo @“%TMP_DIR_WIN%\bin\randomtemp.exe” “%TMP_DIR_WIN%\bin\sccache.exe” “%CUDA_PATH%\bin\nvcc.exe” %%* > “%TMP_DIR%/bin/nvcc.bat”
cat %TMP_DIR%/bin/nvcc.bat
for /F “usebackq delims=” %%n in (cygpath -m "%CUDA_PATH%\bin\nvcc.exe") do set CMAKE_CUDA_COMPILER=%%n
set CMAKE_CUDA_COMPILER_LAUNCHER=%TMP_DIR%/bin/randomtemp.exe;%TMP_DIR%\bin\sccache.exe

I know its for the Visual Studio support but I have only a rough idea what it put out without it the Ninja build system is used but I want to reproduce what the original script does. Can someone show me how the nvcc.bat looks like when this work ?