core: 修复 powershell 下无法正确传递 --image-name 参数

This commit is contained in:
bin456789 2023-12-25 22:05:24 +08:00
parent f34b199bd8
commit c4c7c8e253
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B

View File

@ -79,15 +79,20 @@ if not exist reinstall.sh (
call :download %confhome%/reinstall.sh %~dp0reinstall.sh
)
:: 运行 reinstall.sh
:: 方法1:
:: 为每个参数添加引号,使参数正确传递到 bash
for %%a in (%*) do (
set "param=!param! "%%~a""
)
:: 在c盘根目录下执行 cygpath -ua . 会得到 /cygdrive/c因此末尾要有 /
for /f %%a in ('%SystemDrive%\cygwin\bin\cygpath -ua ./') do set thisdir=%%a
%SystemDrive%\cygwin\bin\bash -l -c "%thisdir%reinstall.sh %*"
:: 方法2:
:: set PATH=/usr/local/bin:/usr/bin
:: 方法1
%SystemDrive%\cygwin\bin\bash -l -c '%thisdir%reinstall.sh !param!'
:: 方法2
:: %SystemDrive%\cygwin\bin\bash reinstall.sh %*
:: 再在 reinstall.sh 里运行 source /etc/profile
exit /b !errorlevel!