Skip to content

Incorrect Directory Path Formatting in Windows (ROOT_DIR Missing Slashes) #2116

@marcolongol

Description

@marcolongol

Description

When running the task CLI tool on Windows, the ROOT_DIR variable appears to return an incorrectly formatted path, missing the expected backslashes \.

Steps to Reproduce:

  1. Create a Taskfile.yaml with the following content:
version: '3'

tasks:
  default:
    - echo {{.ROOT_DIR}}
  1. Run task from the extracted binary location:

C:\Users\WDAGUtilityAccount\Downloads\task_windows_amd64>task

Expected Behavior:

The output should correctly print the full directory path with backslashes:

C:\Users\WDAGUtilityAccount\Downloads\task_windows_amd64

Actual Behavior:

The output is missing backslashes:

C:UsersWDAGUtilityAccountDownloadstask_windows_amd64

Version

3.42.1

Operating system

Windows

Experiments Enabled

No response

Example Taskfile

version: '3'

tasks:
  default:
    - echo {{.ROOT_DIR}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    os: windowsIssues that affect users on Windows.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions