FIND and redirect to a Variable for use at command line
Posted on 2004-04-25
I really should know this but I've got a mental block. Can somebody please suggest a simple correction to the problem area. I've simplified the real paths in this example. It's really just a quick and dirty way I thought of for my father to copy images from the compact flash card of a digital camera into a holding folder, and then immediately open them in thumbnail view in an image browser (IrfanView) with the first image already open in the viewer window.
In case you are wondering, I installed NikonView, which came on CD with the camera, and this launches the "transfer" dialogue when the camera is connected. It then opens the thumbnail browser once transfer is complete. My father already uses IrfanView for viewing, batch resizing, batch conversion and renaming, colour corrections, slideshows, etc. I have a feeling that opening the images in IrfanView would make things easier than finding his way around a clunky and limited program which really is just an intermediate step. It certainly isn't a useful "editor", and keeps forgetting the user preferences I set. It also crippled Norton AntiVirus during an uninstall after it froze up and greyed out a dialogue and menu option, so I don't feel like using it again. Apart from that, it is incredibly easy to "Move to..." or "Copy To..." with right-clicks.
Call it an experiment, if you will, but I wouldn't mind getting this idea to work, unlike my memory of DOS at the moment :-)
DOS 7.10 in the Windows Environment of Win98SE and launched from a desktop shortcut.
IF NOT EXIST %SOURCE%\*.jpg GOTO :EMPTY
COPY %SOURCE%\*.jpg %DEST%\*.jpg
DIR /b /on %DEST%\*.jpg > %ROOT%\list.txt
:: This results in a list of filenames only.
:: need something to strip the top line of
:: list.txt and save it to a variable that
:: can be added to a command line to run
:: the image browser and open that image.
:: *** This is where I stumble. I'm not sure of
:: *** how to direct the "find" results to associate
:: *** the string with the variable "FIRST".
:: *** Here's the obviously wrong syntax, but
:: *** gives the general idea of what I want :-)
SET FIRST= < type %ROOT%\list.txt | find /i "01.jpg"
:: Using the "01.jpg" eliminates the chance that
:: files "image_0011.jpg", etc, are found also.
:: This isn't the real naming convention, just an example.
:: Assuming the first line of list.txt to be
:: image_0001.jpg (as created by a naming convention
:: of the camera that created the images in "SOURCE"),
:: I had thought that I could use the variable
:: "FIRST" something like this
START %PROGDIR%\i_view32.exe %DEST%\%FIRST%
ECHO The camera's flash card is empty
ECHO Press any key to end...
I know the useful Irfanview command line switches, and I would use something like the following, but have left them out for now:
START %PROGDIR%\i_view32.exe %DEST%\%FIRST% /thumbs /ini="%PROGDIR%"