-1
我需要評估某些命令'minishift oc-env'所拋出的命令,該命令中有PATH。在Windows中包含PATH的評估腳本CMD
但是,它似乎是覆蓋整個變量的整個PATH變量。
C:\Users\budhram>echo %PATH%
C:\Program Files\Docker\Docker\Resources\bin;C:\Users\budhram\AppData\Local\Temp;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;.....
C:\Users\budhram>minishift oc-env
SET PATH=C:\Users\budhram\.minishift\cache\oc\v1.5.0;%PATH%;
REM Run this command to configure your shell:
REM @FOR /f "tokens=*" %i IN ('minishift oc-env') DO @%i
C:\Users\budhram>SET PATH=C:\Users\budhram\.minishift\cache\oc\v1.5.0;%PATH%;
C:\Users\budhram>echo %PATH%
C:\Users\budhram\.minishift\cache\oc\v1.5.0;C:\Program Files\Docker\Docker\Resources\bin;C:\Users\budhram\AppData\Local\Temp;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;....
C:\Users\budhram>@FOR /f "tokens=*" %i IN ('minishift oc-env') DO @%i
C:\Users\budhram>echo %PATH%
C:\Users\budhram\.minishift\cache\oc\v1.5.0;%PATH%;
任何想法我們該怎麼做?
這個回答https://stackoverflow.com/a/9370376/1120530也建議使用setlocal enableDelayedExpansion
這似乎不適用於我的情況。
太棒了!工作順利。謝謝 :) – ram