Saturday, November 18, 2017

windows - Randomly execute 35 Batch files

I have 35 batch files in same folder. All batch files have different names and codes inside, i want to create batch file from where i can run 35 batch files randomly with out knowing their names or any characteristics. i created this batch file


@echo off
:loop
SETLOCAL ENABLEDELAYEDEXPANSION
if exist "C:\Users\Administrator\Desktop\converted\*.bat" (
for %%b in ("C:\Users\Administrator\Desktop\converted\*.bat") do (
set /a n=!random! %%35+1
start "" /w "C:\Users\Administrator\Desktop\!n!.bat" "%%b"
ping -n 20 localhost >nul
del "%%b"
)
)
ping -n 60 localhost >nul
goto :loop

but in this case i need to change all batch files name which is not recommended.looking for solution.

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...