mercredi 16 octobre 2019

BAT file Windows Parse if first Charcter is digit

Hy,

i am normally using linux and i would get the problem solved there. For work i have to do a batch script that automatically merges pdf files. it works, but i want a defined structure: The first digit of the file names defines the order (1-5). First all documents (word, xls... etc) get converted in a pdf. then these pdfs are merged according 1-5. Actually all pdfs are merged, 1-5 and then the rest. I thin an if statement will solve it, but how to check if the first Character is a digit? for example: if (first charcter = digit) {convert}

rem MSWord Documents rem MAKES WORD TO PDF set docxs= for /f "tokens=*" %%f in ('dir /on /b *.docx') do set docxs=!docxs! "%%f" "C:\Program Files (x86)\PDF24\pdf24-doctool.exe" -shellPrint –printerName "PDF24" -applyProfile -profile "default/best" -outputDir %CD% %docxs%

rem merge pdf messages rem THIS WILL MERGE all pdfs 1-5 HERE THE IF STATEMENT NEEDS TO BE set pdfs= for /f "tokens=*" %%f in ('dir /on /b *.pdf') do set pdfs=!pdfs! "%%f" pdftk %pdfs% cat output EINGANGSRECHNUNGMITBANF.pdf

no output, just not working

Aucun commentaire:

Enregistrer un commentaire