中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-10 10:01
47,811 topics / 349,897 posts / today 0 new / 48,255 members
DOS批处理 & 脚本技术(批处理室) » [Help] Batch file to exit automatically
Printable Version  695 / 1
Floor1 khjl1 Posted 2008-11-09 21:22
新手上路 Posts 7 Credits 7
The batch commands are as follows:
@echo off&setlocal enabledelayedexpansion
set m=1
for /f "delims=" %%i in (s.txt) do (
set /a n+=1
if !n! leq 20 echo %%i>>s_!m!.txt
if !n! equ 20 set n=0&set /a m+=1
)
echo Done!
set /a dis=1
:11ss
for /f %%i in (s_%dis%.txt) do @ start %%i.bat
s.exe tcp 192.168.0.1 192.168.0.200 445 10 /save
set /a dis=%dis%+1
goto 11ss





I'd like to ask, after splitting s.txt into N files,
the script below runs the split files.
How can I make it automatically exit when it reaches the end and there are no more files???
For example, if s.txt gets split into 5 files,
how can I make the later script automatically exit after start s_5.txt???
How should I modify or rewrite it????
5 is not a fixed number...
Also,
while exiting, delete the files split out from s.txt?
Floor2 tireless Posted 2008-11-10 00:28
银牌会员 Posts 1,122 Credits 2,025
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023