Is there a windows comm开发者_开发知识库and line to return items from a list in random order?
FOR %%g in (dir1 dir2 dir3 dir4) DO (
//do something with any dir returned in random order
)
Thanks
Here is some sample code which may help you. It generates a random number between 0 and 2 (inclusive) and then uses that to pick a directory to work on:
@echo off
setlocal enabledelayedexpansion
set /A R=%random%%% 3
set /A Counter=0
FOR %%g in (dir1 dir2 dir3 dir4) DO (
if !Counter!==%R% echo %%g
set /A Counter+=1
)
精彩评论