This batch file will generate almost random file names. To do this, it takes advantage of the fact that "piping" needs a guaranteed nonexistent filename in order to store the piped data. By piping anything into the DIR command (which ignores the piped data), we can actually see the filename assigned. We can reuse this filename immediately (because the pipe is done with it), or use it or part of it as random. The MODE command is misused here in order to generate a "line fragment" to turn the single line of data we get into a batch file. ------------------ @echo off :: First generate a line fragment mode = > #nvalid.bat :: Get a picture of what's in TEMP now dir %temp% > dir1.txt :: Now pipe something and look at TEMP again echo.|dir %temp% > dir2.txt :: Compare the two DIRs. The difference is the :: almost random name assigned by the pipe. Put :: the results on the end of the fragment fc /lb1 dir1.txt dir2.txt | find ":" >> #nvalid.bat :: Now create an "INVALID.BAT" to do out work echo set TEMPNAME=%%3> invalid.bat :: Now we can run our "#invalid.bat" which will :: in turn run our "invalid.bat" call #nvalid.bat echo %TEMPNAME% is the random name :: Now clean up set TEMPNAME= del ?nvalid.bat del dir?.txt ------------------ My favorite NT/2000 guru Joseph Hayes pointed out that under Windows 2000, you can read the %RANDOM% environment variable to get a random number. http://www.ericphelps.com