Random file as second parameter in command prompt?

Quanti Monati

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!

MC ND
@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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Start command and provide prompt parameter

From Dev

How are command prompt random numbers generated?

From Dev

Pass a string with multiple contiguous spaces as a parameter to a jar file using Windows command prompt called from a java program

From Dev

Running .class File in Command Prompt

From Dev

Command Prompt: java file not found

From Dev

Command Prompt change file icon

From Dev

Running .class File in Command Prompt

From Dev

Post file from Command Prompt

From Dev

.bashrc alias for a command with fixed second parameter

From Dev

Command prompt disappears after a split second of launching the application

From Dev

how to prompt "open file window" from command prompt in java?

From Dev

What is this random name in my command-line prompt?

From Java

Install an apk file from command prompt?

From Dev

Glassfish asadmin batch file not opening command prompt

From Dev

Oracle Database import .sql file by command prompt

From Dev

JDBC Java File Running Through Command Prompt

From Dev

How to hide command prompt for batch file

From Dev

Redirecting contents of a file to a variable in command prompt

From Dev

How to open the command prompt from a file

From Dev

Echo HTML in Command Prompt to file loop

From Dev

Use window command prompt split text file

From Dev

Put editable text in command prompt with bat file

From Dev

Doing operations on a file literally called %A% in command prompt

From Dev

How to access the network file in command prompt?

From Dev

Create text file using echo in command prompt

From Dev

Oracle Database import .sql file by command prompt

From Dev

spool output to particular file from command prompt

From Dev

JDBC Java File Running Through Command Prompt

From Dev

deploying war file in tomcat through command prompt

Related Related

  1. 1

    Start command and provide prompt parameter

  2. 2

    How are command prompt random numbers generated?

  3. 3

    Pass a string with multiple contiguous spaces as a parameter to a jar file using Windows command prompt called from a java program

  4. 4

    Running .class File in Command Prompt

  5. 5

    Command Prompt: java file not found

  6. 6

    Command Prompt change file icon

  7. 7

    Running .class File in Command Prompt

  8. 8

    Post file from Command Prompt

  9. 9

    .bashrc alias for a command with fixed second parameter

  10. 10

    Command prompt disappears after a split second of launching the application

  11. 11

    how to prompt "open file window" from command prompt in java?

  12. 12

    What is this random name in my command-line prompt?

  13. 13

    Install an apk file from command prompt?

  14. 14

    Glassfish asadmin batch file not opening command prompt

  15. 15

    Oracle Database import .sql file by command prompt

  16. 16

    JDBC Java File Running Through Command Prompt

  17. 17

    How to hide command prompt for batch file

  18. 18

    Redirecting contents of a file to a variable in command prompt

  19. 19

    How to open the command prompt from a file

  20. 20

    Echo HTML in Command Prompt to file loop

  21. 21

    Use window command prompt split text file

  22. 22

    Put editable text in command prompt with bat file

  23. 23

    Doing operations on a file literally called %A% in command prompt

  24. 24

    How to access the network file in command prompt?

  25. 25

    Create text file using echo in command prompt

  26. 26

    Oracle Database import .sql file by command prompt

  27. 27

    spool output to particular file from command prompt

  28. 28

    JDBC Java File Running Through Command Prompt

  29. 29

    deploying war file in tomcat through command prompt

HotTag

Archive