Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Ветеран


Сообщения: 874
Благодарности: 575

Профиль | Отправить PM | Цитировать


Здравствуйте, Alexander_88.




Код: Выделить весь код
@echo off
chcp 1251>nul

set quantity=5
set "source=example.txt"
set "border=//=================="

for %%i in ("%source%") do (
 set new=%%~dpni_new%%~xi
 call copy nul %%new%%>nul
 )
set temp_file="%temp%\%random%.vbs"
for /f %%i in ('
 findstr /rx "%border:/=\/%" "%source%"^| find /c /v ""
') do (
 for /f %%j in ('
  set /a %%i-1
 ') do (
  if %%j lss %quantity% (
   call:# %%j
   ) else (
   call:# %quantity%
   )
  )
 )
del %temp_file%

exit /b



:#


 for /l %%i in (1 1 %1) do (
  call set $%%random%%= %%i
  )
 for /f "tokens=* delims=$0123456789=" %%i in ('
  set $^| findstr /v "^0"
 ') do (
  echo WScript.StdOut.Write^(Split^(WScript.CreateObject^("Scripting.FileSystemObject"^).OpenTextFile^("%source%"^).ReadAll^(^),"%border%"^&vbCrLf^)^(%%i^)^)>%temp_file%
  (
  cscript //nologo %temp_file%
  set /p="%border%"<nul
  echo.
  )>>"%new%"
 )

 exit /b
Это сообщение посчитали полезным следующие участники:

Отправлено: 15:28, 26-08-2014 | #2