Skip to content

Commit 1f060ef

Browse files
authored
#764: IDEasy not working properly in CMD (#784)
1 parent 32d0f4a commit 1f060ef

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

CHANGELOG.adoc

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This file documents all notable changes to https://github.com/devonfw/IDEasy[IDE
66

77
Release with new features and bugfixes:
88

9+
* https://github.com/devonfw/IDEasy/issues/764[#764]: IDEasy not working properly in CMD
910
* https://github.com/devonfw/IDEasy/issues/754[#754]: Again messages break processable command output
1011

1112
The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/16?closed=1[milestone 2024.12.001].

cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java

+15
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,21 @@ protected void createStartScript(Path targetDir, String binary, boolean backgrou
471471
}
472472
assert (Files.exists(binFolder));
473473
}
474+
if (this.context.getSystemInfo().isWindows()) {
475+
Path batchFile = binFolder.resolve(getName() + ".bat");
476+
String batchFileContentStart = "@echo off\nsetlocal\nset SCRIPT_DIR=%~dp0\nstart \"\" \"%SCRIPT_DIR%";
477+
String batchFileContentEnd = "\" ";
478+
if (background) {
479+
batchFileContentEnd += " %*";
480+
}
481+
try {
482+
Files.writeString(batchFile, batchFileContentStart + binary + batchFileContentEnd);
483+
} catch (IOException e) {
484+
throw new RuntimeException(e);
485+
}
486+
assert (Files.exists(batchFile));
487+
context.getFileAccess().makeExecutable(batchFile);
488+
}
474489
Path bashFile = binFolder.resolve(getName());
475490
String bashFileContentStart = "#!/usr/bin/env bash\n\"$(dirname \"$0\")/";
476491
String bashFileContentEnd = "\" $@";

0 commit comments

Comments
 (0)