I want to open the file contain two spaces with explorer from Go's exec.Command().
This command works as expected from Windows PowerShell.
Explorer "file://C:\Users\1. Sample\2. Sample2"
And Using Go's exec.Command() works with fileName contain space like this.
exec.Command(`explorer`, "file://C:\Users\1. Sample").CombinedOutput()
But failed with fileName contain two spaces like this
exec.Command(`explorer`, "file://C:\Users\1. Sample\2. Sample2").CombinedOutput()
Please tell me how to solve this.
This code works as expected. Thanks.
exec.Command(`explorer`, `file://C:\Users\1. Sample\2. Sample2`).CombinedOutput()
But actual input is string(not raw string literal) as below. So I think that I need to convert string to raw string.
url := "file://C:\Users\1. Sample\2. Sample2"
<I need to convert to raw string literal?>
result, err := exec.Command(`explorer`, url).CombinedOutput()
if err != nil {
log.Fatal(err)
}