I'm trying to print an local image from my Go program using the Exec Package on Windows 7.
The following command line works fine when ran manually:
rundll32.exe shimgvw.dll ImageView_PrintTo /pt C:\Users\XXXXX\IMAGE.jpg "PRINTERNAME"
I tried:
res, err := exec.Command(
"cmd",
"/c",
"rundll32.exe",
"shimgvw.dll",
"ImageView_PrintTo",
"/pt",
"C:\\Users\\XXXXX\\IMAGE.jpg",
"\"PRINTERNAME\"",
).Output();
or
res, err := exec.Command(
"cmd",
"/c",
"rundll32.exe shimgvw.dll ImageView_PrintTo /pt C:\\Users\\XXXXX\\IMAGE.jpg \"PRINTERNAME\"",
).Output();
But in both cases, it just sends back an empty string as a result and no error. And no effect on the printer tasks list.
I'm sure I'm missing something obvious (something to do with the system environnement when executing the script?). Ideas are welcome!
Thanks.