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(); } }