Basic Wndows scripting problem
Posted: 2016-02-05T07:25:28-07:00
Hello, I have recently installed IM and it is working as described from the command-line.
However I am completely stumped how to invoke IM from a Windows .bat script, and I am sorry to say I do not find a (to me) comprehensible and straightforward tutorial anywhere. Please forgive my probably stupid newbie question.
I started experimenting by simply putting the two well-known lines of code to test whether IM is working into a .bat file:
convert wizard: wizard.png
imdisplay wizard.png
pause
When I execute this .bat no "wizard.png" is created nor displayed. In addition it throws several errors (error descriptions in German since that's the language of my OS):
first line of code: "Unzulässiger Parameter: wizard.png" (parameter "wizard.png" not allowed)
second line: "Der Befehl "imdisplay" ... konnte nicht gefunden werden" (no such command as "imdisplay")
Another attempt was a simple one-line script where one _should_ be able to drag-and drop an image and have it converted to .png format in the same folder:
convert %1 "%~dpn1.png"
This throws similar strange errors, note especially the DIRECTORY invoked in the cmd window (what has MAPI to do with IM?)
C:\Programme\Gemeinsame Dateien\System\Mapi\1031\NT>convert H:\Import\sample.jpg
"H:\Import\sample.png"
Unzulässiger Parameter - "H:\Import\sample.png"
I suspect the machine does not use IM's "convert" but another eponymous routine in the MAPI folder, but why? the MAPI\1031\NT directory is not even part of my Windows Path!!
Thank you very much for yor kind attention and help.
Chris
However I am completely stumped how to invoke IM from a Windows .bat script, and I am sorry to say I do not find a (to me) comprehensible and straightforward tutorial anywhere. Please forgive my probably stupid newbie question.
I started experimenting by simply putting the two well-known lines of code to test whether IM is working into a .bat file:
convert wizard: wizard.png
imdisplay wizard.png
pause
When I execute this .bat no "wizard.png" is created nor displayed. In addition it throws several errors (error descriptions in German since that's the language of my OS):
first line of code: "Unzulässiger Parameter: wizard.png" (parameter "wizard.png" not allowed)
second line: "Der Befehl "imdisplay" ... konnte nicht gefunden werden" (no such command as "imdisplay")
Another attempt was a simple one-line script where one _should_ be able to drag-and drop an image and have it converted to .png format in the same folder:
convert %1 "%~dpn1.png"
This throws similar strange errors, note especially the DIRECTORY invoked in the cmd window (what has MAPI to do with IM?)
C:\Programme\Gemeinsame Dateien\System\Mapi\1031\NT>convert H:\Import\sample.jpg
"H:\Import\sample.png"
Unzulässiger Parameter - "H:\Import\sample.png"
I suspect the machine does not use IM's "convert" but another eponymous routine in the MAPI folder, but why? the MAPI\1031\NT directory is not even part of my Windows Path!!
Thank you very much for yor kind attention and help.
Chris