[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: OT: NEVER MIND



Carl,
Hey, thanks very much. It does work, and it turns out that I prefer using CMD.EXE to using 4DOS.
If you're not busy (and who is in this economy), could you explain the "for
/f line"? I'm guessing that the delims are spaces as delimiters, and
counting 6 words in the dir listing, that gets you to the drive name. And
maybe "tokens" is the index for the loop that counts up 6. But even if
those guesses are right, I don't know what the
"%%A ... do" part means.

--Harry
Reply to note from Harry Binswanger  Tue, 21 Sep 2010
10:24:49 -0400

Harry:

> I'm sure there's a way, probably simple, to do this in
> CMD.EXE's .bat file

No doubt there's a pithier way to do it, but this should work:

@echo off
set V=
for /f "tokens=6 delims= " %%A in ('dir w: ^| find/i "volume in"') do set V=%%A
if not "%V%"=="Week-ATAPI6" goto :eof
:: Commands that execute only if volume label is "Week-ATAPI6":
XCOPY blah blah
[command]
[command]
set V=
goto :eof

You may need to tweak the FOR statement, depending on the exact output
of the DIR command on your system, but you get the idea.

Also, note that FOR...IN....DO is a single line (delete any internal
carriage return if one was inserted by your mail client).

--
Carl Distefano
cld@xxxxxxxx


Harry Binswanger
hb@xxxxxxxx