From 8b9eeb68f77c71a68ca348d574a5d068f5429d2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=9E=E5=BA=90?= <109708109+CiiLu@users.noreply.github.com> Date: Sat, 7 Mar 2026 20:51:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20BAT=20=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E9=99=90=E5=88=B6=E4=B8=BA=2032767=20(#5697)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Close #4044 --- .../java/org/jackhuang/hmcl/launch/DefaultLauncher.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java index c155147259..565ddb5db9 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java @@ -650,8 +650,10 @@ public class DefaultLauncher extends Launcher { final String command = usePowerShell ? null : commandLine.commandLine.toString(); Map envVars = getEnvVars(); - if (!usePowerShell && isWindows) { - if (command.length() > 8192) { // maximum length of the command in cmd + if (isWindows && !usePowerShell) { + // https://stackoverflow.com/a/28452546 + // https://learn.microsoft.com/troubleshoot/windows-client/shell-experience/command-line-string-limitation + if (command.length() > 32767) { throw new CommandTooLongException(); } }