[AccessD] OT:Batch File Syntax

Arthur Fuller fuller.artful at gmail.com
Tue Mar 18 20:38:59 CDT 2008


Oops. That was supposed to be %%x not %x%. And to hell with the suspense,
here's an example:

for %%x in (system, command, shellnew, system32) do dir "%windir%\%%x" /W

This won't run straight from the command line. Save it as a file called
fordemo.cmd and then run it.

A.

On 3/18/08, Arthur Fuller <fuller.artful at gmail.com> wrote:
>
> Whichever test you use, provided there is a goto then the other test is
> not required -- unless of course you have more than one branch, in which
> case you would need more than one IF since there is no equivalent to Select
> Case:
>
> if exist c:\autoexec.bat goto Yupper
> echo c:\autoexec.bat does not exist.
> echo Your mother wears army boots.
> echo Run as many commands here as you wish. When you're done...
> goto Done
>
> :yupper
> copy c:\autoexec.bat c:\autoexec.old
> echo Do something else.
> echo Do something else.
> goto Done             <---- this, in this example, is redundant, since the
> next line is the Done label
>
> :Done
> echo That's all for now, folks.
> echo When you're ready for something really hip, ask me about for %x%
> in().
> echo Batch languages are surprisingly powerful.
>
> Arthur



More information about the AccessD mailing list