2006-02-01

There should be no spaces in set

Just a quick note... whenever scripting .cmd or .bat files remeber that when seting variables like:

set myvar=myval

There must be no spaces around the '=' sign...

For example

set myDir = c:\temp
c:
cd cd %myDir%
del /S /Q *

will delete everything on the C: partition ...
Changing the first line to

set myDir=c:\temp

makes ALL the difference in the world.
Don't ask me how I figured this little nugget out, just thank yourself that it was me and not you.

Oh, by the way, this is on w2k3 server, so it's not impossible that another version of wintendo behaves differently.