@echo off
This script will generate a text file with 1000 words. In order to do this
we will use a loop that will iterate 1000 times and write a random word to the file each time.
Here is the code:
```batch
@echo off
setlocal EnableDelayedExpansion
set words=apple banana cherry dog elephant frog grape honeydew iguana jackal kangaroo lion monkey
set /a count=0
for /l %%i in (1
1
1000) do (
set /a index=!random! %% 10
for /f "tokens=1
2 delims= " %%a in ('echo !words!') do (
if !index! equ 0 echo %%a >> output.txt
set /a index=!index!-1
)
)
endlocal
```
Save this code as a .bat file and run it in Command Prompt. It will generate a file called output.txt with 1000 randomly selected words from the list provided. Feel free to modify the list of words if you want different words to be included in the output file.
咨询微信客服
0516-6662 4183
立即获取方案或咨询top