Para hacer un .BAT que escriba ficheros txt con nombre 1.txt 2.txt 3.txt …hay unas manera de hacerlo.
Vamos a comentar 2 casos en concreto.
1. Usando la comando attrib:
@echo off
attrib /s .\*.* | find /c "\" > a.txt
for /f "usebackq tokens=1" %%i in (`type .\a.txt`) do set a=%%i
set b=%a%
set /a j=(%b%)-1
echo %j% > %j%.txt
del a.txt
2. Usando comandos matemáticas:
@echo off
for /f "usebackq tokens=1" %%i in (`type .\0.txt`) do set a=%%i
set b=%a%
echo %b% > %b%.txt
set i=%b%
set /a j=(%i%)+1
echo %j% > 0.txt
del .txt
del echo.txt
¿Quería saber si hay mas manera de hacerlo?










Autor


En línea
