@echo off REM Check for too few or too many parms and error IF (%1)==() GOTO ERROR IF NOT (%9)==() GOTO ERROR REM Set some default values SET ggmask=%1 SET ggtimes=1 SET ggwait=NO SET ggserv=(local) SET gguser=-E SET ggwaitparm=/NORMAL SET ggwin=NORMAL SET ggout=YES REM Move parameters to variables IF NOT (%2)==() SET ggtimes=%2 IF NOT (%3)==() SET ggwait=%3 IF NOT (%4)==() SET ggwin=%4 IF NOT (%5)==() SET ggout=%5 IF NOT (%6)==() SET ggserv=%6 IF NOT (%7)==() SET gguser=%7 REM Set this to empty if not supplied SET ggpwd=%8 REM Set this to empty SET ggoutparm=%9 REM Further process some of the parameters IF NOT (%ggpwd%)==() SET ggpwd=-P%ggpwd% IF /i %ggwait%==YES SET ggwaitparm=/WAIT IF NOT %gguser%==-E SET gguser=-U%gguser% IF /i %ggout%==YES SET ggoutparm=-o%%~nf.OUT REM Run the script(s) using a nested loop REM REM The inner loop iterates through the files matching the mask and runs them REM The outer loop executes the inner loop the number of times specified FOR /L %%i in (1,1,%ggtimes%) DO FOR %%f IN (%ggmask%) DO START "%%f" %ggwaitparm% /%ggwin% OSQL.EXE -S%ggserv% %gguser% %ggpwd% -i%%f %ggoutparm% GOTO NOERROR :ERROR echo You must specify a script to run SET ERRORLEVEL=1 ECHO STRESS.CMD ECHO . ECHO Runs specified Transact-SQL script(s) multiple times simultaneously ECHO . ECHO Copyright (c) 1992, Ken Henderson. All rights reserved. ECHO Based on my code in User-to-User, PC Magazine, March 26, 1991. ECHO . ECHO USAGE: STRESS script [N] [wait] [windowstyle] [saveoutput] [server] [user] [password] ECHO . ECHO where: ECHO script = the script or mask you want to run ECHO N = the number of times you want to run it (default 1) ECHO wait = YES to wait for each script to finish before running next (default NO) ECHO windowstyle = type of window to create for each script execution: ECHO . ECHO MIN = minimized MAX = maximized B = no window NORMAL = normal window ECHO . ECHO saveoutput = YES to save output to file using -o OSQL parameter (default YES) ECHO server = the server to run it on (default (local) ) ECHO user = your SS user name (default - use trusted connection) ECHO password = your SS password (default - use trusted connection) :NOERROR