Answer the question
In order to leave comments, you need to log in
How to make a unique save without using a date in a batch file?
Current code:
set dir1=C:\TEST\ScanTo\
set strTime=_%Date%_%Time%
set strTime=%strTime::=-%
set strTime=%strTime:,=-%
set strTime=%strTime:/=-%
%SYSTEMDRIVE%
Answer the question
In order to leave comments, you need to log in
Create a file - for example
count.txt
and store an intermediate value for the increment
there. Deleted the scans and you have to start over - delete the file.
if the file names differ only by the number and the number is a constant number of digits, i.e. not scan_1, but scan_000001, scan_000002, scan_000003, then you can:
@echo off
for /f %%a in ('dir /b /on "scan_*. jpg"') do set tmp=%%a&goto lev1
:lev1
echo %tmp%
set /a next_file_num=%tmp:~-10.6% +1
set next_file_num_str=000000%next_file_num%
set next_file_num_str=%next_file_num_str:~-6 %
set next_file_name=scan_%next_file_num_str%.jpg
echo %next_file_name%
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question