Skip to content

os/exec: BAT file under path including white-space cannot run specifying blank argument #9084

@gopherbot

Description

@gopherbot

by nobeans:

What does 'go version' print?

go version go1.3.3 windows/386

What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.

1. Copy https://gist.github.com/nobeans/1fcc22ea9268746455b0 to your local machine like
test-run-bat.go.
2. Create C:\\DIR WITH SPACES\\test.bat with a content like "echo Hello"
3. Run this script `go run test-run-bat.go`

What happened?

An unexpected error occurs to run a BAT file under a path having a white-space only when
specifying a blank argument.
The error message is like this:

'C:\DIR' is not recognized as an internal or external command,
operable program or batch file.

What should have happened instead?

It should be able to run successfully as running a exe file.

Please provide any additional information below.

It doesn't occur without a blank argument even for a BAT file in Windows.
It doesn't occur with/without a blank argument for a EXE file in Windows.
And it doesn't occur with any arguments in Mac and Linux.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions