I'm somewhat new to batch, and I'm trying to build a program in batch that renames all the files to numbers, but it just doesn't work, I have no idea what the problem is here, I hope someone can help me find it.
@echo off
SET x=0
for %%I in (*) do(
SET /a x+=1
REN %%I %x%
)
pause
How about this quick one ?
I provided an if condition to prevent the batch from renaming itself in case you have it in the same directory where your files are. (e.g. while testing) You might want to change this according to your needs...
numberize.bat
@ECHO OFF
SetLocal EnableDelayedExpansion
set /a x=0
for %%i in (*) do ( call :doit "%%i" )
goto eof
:doit
if /I %1 NEQ "numberize.bat" (
set /a "x=x+1"
ren %1 %x%
)
EXIT /B
:eof
EndLocal