I am writing a program in Golang that will use Mozilla's Thunderbird email client to send email. The Windows command that should be executed is:
start "" "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe" -compose "to='CloudCoin@Protonmail.com',subject='Subject1',body='Hello'" -offline
My Go code looks like this (command is the one listed above) :
var command string
command = `start "" "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe"`
command += ` -compose "to='` + toAddress + `',`
command += `subject='Subject1',`
command += `body='Hello'"`
command += ` -offline`
cmd := exec.Command("cmd.exe", "/C", command)
But I get an error:
Windows cannot find '\\'. Make sure you typed the name correctly, and then try again.
If I change the code to this (moving the word start):
var command string
command = ` "" "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe"`
command += ` -compose "to='` + toAddress + `',`
command += `subject='Subject1',`
command += `body='Hello'"`
command += ` -offline`
fmt.Println("Command: " + command)
cmd := exec.Command("cmd.exe", "/C", "start", command)
Then I get another error:
Windows cannot find 'Files'. Make sure you typed the name correctly, and then try again.
It seems that instead of trying to start "" it is trying to start \\. How can I keep my double-quotes?