I have one string
FOR %%A in (SRCdocs\*.doc) DO doc2rtf -f addon\format1.fmt -file "%%A" -out "%%A.rtf"
This string process all source *.doc files in subfolder "SRCdocs", apply ONE FORMAT FILE (format1.fmt from subfolder "addon"). As result, I have all doc files converted to rtf with applying only one format filter (format1.fmt)
I need to edit this line for implementation of applauding random filter for each doc to rtf conversion.
How to do that?
Thanks!
@echo off
setlocal enableextensions disabledelayedexpansion
set "count=0"
for /f "tokens=1,* delims=:" %%a in ('dir /b /a-d "addon\*.fmt"^|findstr /n "^"') do (
set "format[%%a]=%%b"
set "count=%%a"
)
for %%a in ("SRCdocs\*.doc") do (
setlocal enabledelayedexpansion
set /a "format=!random! %% %count% + 1"
for %%b in ("!format!") do for %%c in ("!format[%%~b]!") do (
endlocal
echo doc2rtf -f "addon\%%~c" -file "%%~fa" -out "%%~fa.rtf"
)
)
Load the .fmt
file list in an array in memory. Now, for each of the input .doc
files select a random element from the list of .fmt
files.
doc2rtf
command is only echoed to console. If the output is correct, remove the echo
command.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments