I have problem with this code. The cmd go at 100% of cpu and hang.
This on windows 7
can anyone confirm?
Code: Select all
@echo off
setlocal EnableDelayedExpansion
if "%~1" neq "" goto %1
:main
type nul >t1.txt
start "" /WAIT "%~0" loop1 ^^^>t1.txt | start "" /WAIT "%~0" loop2 ^^^<t1.txt
exit/b
:loop1
set "fill=#"
for /L %%i in (1,1,10) do set "fill=!fill!!fill!"
set /a num=1
for /l %%f in () do (
set /a "num+=1
set msg=!num!!fill!
title sending... !num!
echo !msg:~0,1021!
if "!num!"=="5000" (
title quitting...
set msg=quit!fill!
echo !msg:~0,1021!
ping localhost -n 4 >nul
exit /b
)
)
:loop2
set /A num=1
for /L %%N in () do (
set "v="
set /P "v="
if not defined v (
echo v not defined
ping localhost -n 2 >nul
) else (
set /A "num+=1
echo(^>'!v:~0,20!'...[!num!]
)
if /I "!v:~0,4!"=="quit" (
title quitting...
ping localhost -n 4 >nul
exit /b
)
)
EDIT:have insert a row in the code "type nul >t1.txt". There was an error.
EDIT2: Removed %%R in code.
einstein1969