I created a Menu to call this script that renames multiple text files randomly, it is only working in a .bat file alone. But it is not working in the context of the menu I created, I believe it's something to do with looping, since it only renames the first file! I would like someone to evaluate the situation, thank you very much already.
:4
cls
setlocal disableDelayedExpansion
set "chars=ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
for /f "eol=: delims=" %%F in ('dir /b /a-d *.txt') do call :renameFile "%%F"
exit /b
:renameFile
setlocal enableDelayedExpansion
:retry
set "name="
for /l %%N in (1 1 8) do (
set /a I=!random!%%36
for %%I in (!I!) do set "name=!name!!chars:~%%I,1!"
)
echo if exist !name!.txt goto :retry
endlocal & ren %1 %name%.txt
)
pause
goto Menu
)
:5 < - here start the next option of menu
...
Aucun commentaire:
Enregistrer un commentaire