подскажите как создать пустые txt файлы
пользователем задается например i1 = 0, i2 = 2
маска в виде "_i.Extension"
и батник должен создать все недостающие файлы в папке с хвостиком от 0 до 2


[/spoiler]Код: Выделить всё
@echo off
setlocal
pushd d:\test
set a=0
set z=3
for /f "tokens=*" %%i in ('dir /b /a-d') do call:1 "%%i"
popd
goto:eof
:1
for /f "tokens=1 delims=_" %%i in ("%~n1") do (
for /l %%j in (%a%,1,%z%) do (
if not exist "%%i_%%j.*" cd.>"%%i_%%j.txt"
))Код: Выделить всё
@echo off
setlocal
pushd d:\test
set "a=0"
set "z=3"
for /f "tokens=*" %%i in ('dir /b /a-d') do call:1 "%%i"
popd
goto:eof
:1
set "t="
set "check=0"
set "f=%~n1"
set "f=%f: =?%"
set "f=%f:,=:%"
for %%i in (%f:_=,%) do set /a t+=1
for /f "tokens=%t% delims=_" %%i in ("%~n1") do (
set "last=%%i"
if not %%i==0 (
for /f %%j in ('set /a %%i-1') do set "check=%%j"
))
if not "%check%"=="-1" (call:2 %1) else (call:3 %1)
goto:eof
:2
setlocal enabledelayedexpansion
set "remove=%last%%~x1"
set "name=%~1"
for /l %%i in (%a%,1,%z%) do (
if not exist "!name:%remove%=!%%i.*" cd.>"!name:%remove%=!%%i.txt"
)
endlocal
goto:eof
:3
if not exist "%~n1_%a%%~x1" ren %1 "%~n1_%a%%~x1"
for /l %%i in (%a%,1,%z%) do (
if not exist "%~n1_%%i.*" cd.>"%~n1_%%i.txt"
)

Код: Выделить всё
@echo off
setlocal
pushd d:\test
set "a=0"
set "z=5"
for /f "tokens=*" %%i in ('dir /b') do call:1 "%%i"
popd
goto:eof
:1
for /f "tokens=*" %%i in ('dir /b "%~n1.*"') do (
for /l %%j in (%a%,1,%z%) do (
if not exist "%~n1_%%j.*" cd.>"%~n1_%%j%~x1"
))