A
A
Alexey Yarkov2015-12-15 17:50:15
cmd/bat
Alexey Yarkov, 2015-12-15 17:50:15

What's wrong with the batch file?

All pictures in the folder must be added to the beginning of a random number. What's wrong?

set MIN=999
set MAX=9999


for /f %%a in (*.jpg) do (
  @SET /a n=%MIN%+(%MAX%-%MIN%+1)*%random%
  ren "%%~dpa*.jpg" "%%%n%a.jpg"
)

pause

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2015-12-15
@yarkov

A lot of things are wrong :-(
Create 2 files written below and run the first
file _runme.cmd
file process.cmd

for %%a in (*.jpg) do (
  SET /a n=1000+!RANDOM!*8999/32768
  ren "%%a" "!n!%%a"
)
pause

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question