On Fri, Aug 31, 2012 at 11:40 AM, Schasologe <
e...@living-lexicon.at> wrote:
> I have the following problem:
> I try to execute an external program with os/exec under Windows (Windows 7,
> 32 bit). I use this code:
>
> qvParam = " /R /NOSECURITY "
> ......
> parameter := qvParam + filename
> cmd := exec.Command("Qv.exe", parameter)
> err := cmd.Start()
> filename is read in from a textfile.
>
> When I run the code, "Qv.exe" is being launched, but NOT with the correct
> parameters. If I check what is happening with procmon, I see that Windows
> gets this command:
> Qv.exe " /R /NOSECURITY D:\lager.qvw"
>
> (including the double quotes!!). If I paste this command string to the
> command line it fails of course, becaus the command should look like this
>
> Qv.exe /R /NOSECURITY D:\lager.qvw
>
> I have been trying for hours now, also with back quotes and concatenation of
> "Qv.exe" + parameter + filename, but with no success; I always get the
> double quotes in the parameters.
>
> Can anybody help? I've already searched the internet but haven't found a
> solution to my problem.
> BTW I'm new to Go.
You're carefully constructing and passing a single parameter to qv.exe
and that's what you get. It's correct per the documentation.
I think something like 'cmd := exec.Command("qv.exe", "/R",
"/NOSECURITY", filename)' should work. No windows, not tested.
-j