This is an automated email from the ASF dual-hosted git repository.

jt2594838 pushed a commit to branch fix_windows_cmd
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 5a9c8f193cc812dd1404325498e2d11842c23ef0
Author: Tian Jiang <[email protected]>
AuthorDate: Thu Jun 11 15:51:15 2026 +0800

    Fix -pw without password may take incorrect args
---
 scripts/sbin/windows/start-cli.bat | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/scripts/sbin/windows/start-cli.bat 
b/scripts/sbin/windows/start-cli.bat
index d3d85632533..8849e3ca431 100644
--- a/scripts/sbin/windows/start-cli.bat
+++ b/scripts/sbin/windows/start-cli.bat
@@ -60,9 +60,13 @@ if /I "%~1"=="-u" (
     goto parse_args
 )
 if /I "%~1"=="-pw" (
+    call :is_known_option "%~2"
     if "%~2"=="" (
         set "passwd_param=-pw"
         shift
+    ) else if "!IS_KNOWN_OPTION!"=="true" (
+        set "passwd_param=-pw"
+        shift
     ) else (
         set "passwd_param=-pw %~2"
         shift
@@ -93,6 +97,23 @@ set "PARAMETERS=%PARAMETERS% %~1"
 shift
 goto parse_args
 
+:is_known_option
+set "IS_KNOWN_OPTION=false"
+if /I "%~1"=="-h" set "IS_KNOWN_OPTION=true"
+if /I "%~1"=="-p" set "IS_KNOWN_OPTION=true"
+if /I "%~1"=="-u" set "IS_KNOWN_OPTION=true"
+if /I "%~1"=="-pw" set "IS_KNOWN_OPTION=true"
+if /I "%~1"=="-e" set "IS_KNOWN_OPTION=true"
+if /I "%~1"=="-help" set "IS_KNOWN_OPTION=true"
+if /I "%~1"=="-sql_dialect" set "IS_KNOWN_OPTION=true"
+if /I "%~1"=="-disableISO8601" set "IS_KNOWN_OPTION=true"
+if /I "%~1"=="-c" set "IS_KNOWN_OPTION=true"
+if /I "%~1"=="-timeout" set "IS_KNOWN_OPTION=true"
+if /I "%~1"=="-usessl" set "IS_KNOWN_OPTION=true"
+if /I "%~1"=="-ts" set "IS_KNOWN_OPTION=true"
+if /I "%~1"=="-tpw" set "IS_KNOWN_OPTION=true"
+exit /b 0
+
 :after_parse
 REM Combine all parameters
 set "PARAMETERS=%host_param% %port_param% %user_param% %passwd_param% 
%sql_dialect_param% %PARAMETERS%"
@@ -139,4 +160,4 @@ REM Run CLI
 REM -------------------------------
 endlocal
 
-exit /b %ERRORLEVEL%
\ No newline at end of file
+exit /b %ERRORLEVEL%

Reply via email to