|You should save this in a different folder, or change (*) to (.txt) or whatever you are renaming. If you do put this batch in the same folder ie c\12345 you can loose the pushd.|
for %%a in (.) do set dir=%%~nxa
for %%a in (*) do call :name "%%~a"
ren "%file%" "%dir%%file%"