1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| @echo off
setlocal enableextensions enabledelayedexpansion
chcp 1252 >nul
set reference=139993
set "dossier=dossier Y"
for /f "delims=" %%A in ('dir /b /a-d "*TCPP*"') do (
(findstr "RFF3UNC" "%%~A" | find "%reference%") && call :ecriture "%%~A"
)
explorer /select,%dossier%
exit /b 0
:ecriture
set "fichier=%~1"
set "fichier=!fichier:TCPP=TCPM!"
set ligne=0
for /f "usebackq tokens=1-2,*" %%B in ("%~1") do (
set "chaine=%%~B"
set /a ligne+=1
if !ligne! EQU 1 (echo %%B)
if !ligne! EQU 3 (
set destinataire=!chaine:~18,14!
echo ^<EDI_EMETTEUR^>!destinataire!^</EDI_EMETTEUR^>
echo ^<EDI_DESTINATAIRE^>00000000000018^</EDI_DESTINATAIRE^>
)
if !ligne! EQU 4 (echo %%B)
if !ligne! EQU 5 (echo %%B)
if !ligne! EQU 6 (echo %%B)
if !ligne! EQU 7 (echo %%B !destinataire! %%D)
if !ligne! EQU 8 (echo %%B 00000000000018 %%D)
if !ligne! GEQ 9 (echo %%B %%C)
)>>!fichier!
>nul move !fichier! %dossier%
goto :eof |
Partager