Actually, in my script I am enquoting
all the file paths and the process works just fine. But then again, I am scripting in autohotkey, not batch. I'm using AutoHotkey 1.1.11.01 on Windows 7 x64.
Here is a working Autohotkey script. Just save it as, oh, say,
nconvert.ahk, be sure and set your
outputDir path and then drop files on it.
Code: Select all
;Drag and drop a handful of images onto the script itself
;by BGM Wednesday, October 23, 2013
#noenv
nconvert := "C:\Program Files (x86)\XnView\nconvert.exe" ;this may be different on your computer
outputDir := "c:\some folder\some other folder\" ;make sure there is a trailing backslash...
loop, %0%
{
GivenPath := %A_Index% ; Fetch the contents of the variable whose name is contained in A_Index.
Loop %GivenPath%, 1
{
RunNC(A_LoopFileLongPath)
}
}
msgbox, Okay Bob! All Done!
;-------------------------------------------------------------------
RunNC(whatfile){
global
splitpath, whatfile,,,,filenameonly ;fetch just the name without the extension
outputfile := chr(34) . outputDir . filenameonly . ".jpg" . chr(34)
inputfile := chr(34) . whatfile . chr(34)
;notice that the full input path goes enquoted at the end.
;the output file is built from the original file name, and it gets enquoted, too
parameters := "-ratio -rtype lanczos -resize 700 525 -dpi 72 -keepfiledate -overwrite -out jpeg -o " . outputfile . " " . inputfile
msgbox %parameters%
run, %nconvert% %parameters%,,hide ;we want to hide all those cmd boxes
}
;-------------------------------------------------------------------