Skip to content

Windows: sbt.bat fails when project path contains parentheses #8644

@AnshumanAI

Description

@AnshumanAI

Description

SBT fails to run on Windows when the project directory path contains parentheses (). The Windows batch launcher (sbt.bat) does not properly escape or quote paths with special characters, causing CMD to interpret parentheses as command grouping syntax.

Steps to Reproduce

  1. Create a Windows user account with parentheses in the username (e.g., Anshuman(work))
  2. Create or clone an SBT project in a path containing parentheses:
    C:\Users\Anshuman(work)\Desktop\myproject
    
  3. Open CMD or PowerShell
  4. Navigate to the project directory
  5. Run any SBT command:
    sbt compile
    

Expected Behavior

SBT should execute the command successfully, handling the parentheses in the path correctly.

Actual Behavior

In CMD:

) was unexpected at this time.

In PowerShell (calling sbt.bat):

) was unexpected at this time.

The error occurs because Windows CMD interprets ( and ) as special syntax for command grouping, and the SBT launcher script doesn't properly quote the working directory path.

Environment

  • OS: Windows 11
  • SBT Version: 1.11.7 (likely affects all versions)
  • Java Version: OpenJDK 11.0.29
  • Shell: Both CMD and PowerShell (when using sbt.bat)
  • Path with issue: Any path containing ( or ) characters

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugarea/runner-scriptissues around sbt-the-bash-script, or bat scriptarea/windowsWindows-specific issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions