Windows: generated junie.bat fails with The system cannot find the batch label specified - after_channel_oneshot
Description
After installing Junie CLI on Windows using the official install.ps1 script, running junie --help fails with the following error:
The system cannot find the batch label specified - after_channel_oneshot
The issue was reproducible even after removing Junie and reinstalling it.
It looks like the generated Windows batch shim file junie.bat may be written with line endings that are not handled correctly by cmd.exe.
Rewriting the generated junie.bat file with Windows CRLF line endings fixed the issue.
Environment
- OS: Windows 11
- Shell: PowerShell
- Junie command resolved to:
C:\Users\andre\.local\bin\junie.bat
Installation command
powershell -NoProfile -ExecutionPolicy Bypass -Command "iex (irm 'https://junie.jetbrains.com/install.ps1')"
Steps to reproduce
- Install Junie CLI on Windows using the official installer:
powershell -NoProfile -ExecutionPolicy Bypass -Command "iex (irm 'https://junie.jetbrains.com/install.ps1')"
- Run:
Actual result
The command fails with:
The system cannot find the batch label specified - after_channel_oneshot
Expected result
junie --help should work immediately after installation.
Diagnostics
where.exe junie output:
C:\Users\andre\.local\bin\junie.bat
Get-Command junie -All output:
CommandType Name Version Source
----------- ---- ------- ------
Application junie.bat 0.0.0.0 C:\Users\andre\.local\bin\junie.bat
So there does not appear to be another junie executable earlier in PATH. The command resolves only to the generated batch file:
C:\Users\andre\.local\bin\junie.bat
Workaround
The issue was fixed by rewriting the generated junie.bat file with Windows CRLF line endings:
$p = "$env:USERPROFILE\.local\bin\junie.bat"
Copy-Item $p "$p.bak" -Force
$text = [System.IO.File]::ReadAllText($p)
$text = $text -replace "`r?`n", "`r`n"
$utf8NoBom = [System.Text.UTF8Encoding]::new($false)
[System.IO.File]::WriteAllText($p, $text, $utf8NoBom)
junie --help
After this, junie --help started working correctly.
Additional notes
This seems to indicate that the generated Windows batch shim may need to be written explicitly with CRLF line endings.
The batch file appears to jump to the :after_channel_oneshot label, but before normalizing line endings, cmd.exe fails with:
The system cannot find the batch label specified - after_channel_oneshot
After converting line endings to CRLF, the same generated batch file works correctly.
Windows: generated
junie.batfails withThe system cannot find the batch label specified - after_channel_oneshotDescription
After installing Junie CLI on Windows using the official
install.ps1script, runningjunie --helpfails with the following error:The issue was reproducible even after removing Junie and reinstalling it.
It looks like the generated Windows batch shim file
junie.batmay be written with line endings that are not handled correctly bycmd.exe.Rewriting the generated
junie.batfile with Windows CRLF line endings fixed the issue.Environment
C:\Users\andre\.local\bin\junie.batInstallation command
Steps to reproduce
junie --helpActual result
The command fails with:
Expected result
junie --helpshould work immediately after installation.Diagnostics
where.exe junieoutput:Get-Command junie -Alloutput:So there does not appear to be another
junieexecutable earlier inPATH. The command resolves only to the generated batch file:Workaround
The issue was fixed by rewriting the generated
junie.batfile with Windows CRLF line endings:After this,
junie --helpstarted working correctly.Additional notes
This seems to indicate that the generated Windows batch shim may need to be written explicitly with CRLF line endings.
The batch file appears to jump to the
:after_channel_oneshotlabel, but before normalizing line endings,cmd.exefails with:After converting line endings to CRLF, the same generated batch file works correctly.