From c4c7c8e25347fcf7edb7f064371eac3a7151fffa Mon Sep 17 00:00:00 2001 From: bin456789 Date: Mon, 25 Dec 2023 22:05:24 +0800 Subject: [PATCH] =?UTF-8?q?core:=20=E4=BF=AE=E5=A4=8D=20powershell=20?= =?UTF-8?q?=E4=B8=8B=E6=97=A0=E6=B3=95=E6=AD=A3=E7=A1=AE=E4=BC=A0=E9=80=92?= =?UTF-8?q?=20--image-name=20=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reinstall.bat | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/reinstall.bat b/reinstall.bat index e56da0c..a972487 100644 --- a/reinstall.bat +++ b/reinstall.bat @@ -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!