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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
| @echo off
SETLOCAL EnableDelayedExpansion
set /p annee=ANNEE A TRAITER :
set /p mois_debut=MOIS DE DEBUT :
set /p mois_fin=MOIS DE FIN :
set /p indice=INDICE MAXIMUM :
SET /p syst=SYSTEME (AAAA/BBBB) :
if %syst% equ AAAA ( set "mypath=c:\archives\aaaa\" )
if %syst% EQU BBBB ( set "mypath=c:\archives\bbbb" )
if %mois_debut% lss 10 ( if %mois_debut:~0,1%==0 ( set mois_debut=!mois_debut:~1,2!))
if %mois_fin% lss 10 ( if %mois_fin:~0,1%==0 ( set mois_fin=!mois_fin:~1,2! ))
for /L %%z in (!mois_debut!,1,!mois_fin!) do (
for /L %%x in (6,1,31) do (
for /L %%y in (0,1,!indice!) do (
set mois=%%z
set jour=%%x
set indice=%%y
if !mois! lss 10 ( set mois=0!mois!)
if !jour! lss 10 ( set jour=0!jour!)
set indice=%%y
set "fichier_a_ouvrir=%mypath%AAAA_%annee%!mois!!jour!_!indice!.trk
if exist !fichier_a_ouvrir! (
echo !fichier_a_ouvrir!
set /a compteur=0
set /a operande=256
set /a c=0
set /a bb=0
set /a comparaison=!operande!*!bb!
set /a comparaison1=!comparaison!+1
call :traitement !fichier_a_ouvrir! !bb! !operande!
)
)))
if exist !syst!_!annee!_m1_test.txt ( ren !syst!_!annee!_m1_test.txt !syst!_!annee!_m1_test.xls )
if exist !syst!_!annee!_m2_test.txt ( ren !syst!_!annee!_m2_test.txt !syst!_!annee!_m2_test.xls )
if exist !syst!_!annee!_n1_test.txt ( ren !syst!_!annee!_n1_test.txt !syst!_!annee!_n1_test.xls )
if exist !syst!_!annee!_n2_test.txt ( ren !syst!_!annee!_n2_test.txt !syst!_!annee!_n2_test.xls )
del *.txt
:strlen
set string=%~2
set stringLength=0
:lengthLoop
set string=%string:~1%
set /a stringLength+=1
if defined string goto lengthLoop
set %~1=!stringLength!
goto :EOF
:traitement
set fichier_a_ouvrir=%~1
set operande=%~3
set bb=%~2
echo %fichier_a_ouvrir%
for /f "tokens=1,2,3,4,5,6,7,8 delims= " %%a in ('type !fichier_a_ouvrir!') do ( set VrFchRcnt=%%a %%b %%c %%d %%e %%f %%g %%h
rem echo !VrFchRcnt!
set /a comparaison=!operande!*!bb!
set /a comparaison1=!comparaison!+1
set /a c=!c!+1
if !c! EQU !comparaison1! (
set /a bb=!bb!+1
set chaine=%%a
call :strlen nb1 !chaine!
set/a deb1=0
set chaine=%%b
call :strlen nb2 !chaine!
set/a deb2=!nb1!+1+!deb1!
set chaine=%%c
call :strlen nb3 !chaine!
set/a deb3=!nb2!+1+!deb2!
set chaine=%%d
call :strlen nb4 !chaine!
set/a deb4=!nb3!+1+!deb3!
set chaine=%%e
call :strlen nb5 !chaine!
set/a deb5=!nb4!+1+!deb4!
set chaine=%%f
call :strlen nb6 !chaine!
set/a deb6=!nb5!+1+!deb5!
set chaine=%%g
call :strlen nb7 !chaine!
set/a deb7=!nb6!+1+!deb6!
set chaine=%%h
call :strlen nb8 !chaine!
set/a deb8=!nb7!+1+!deb7!
echo 0 !nb1! !deb2! !nb2! !deb3! !nb3! !deb4! !nb4! !deb5! !nb5! !deb6! !nb6! !deb7! !nb7! !deb8! !nb8!>temp.txt
::pause
for /f "tokens=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 delims= " %%i in ('type temp.txt') do ( set VrFchRcnt1=%%i %%j %%k %%l %%m %%n %%o %%p %%q %%r %%s %%t %%u %%v %%w %%x
set "$val1=!VrFchRcnt:~%%u,%%v!"
set $val1=!$val1:.=,!
set "$val2=!VrFchRcnt:~%%w,%%x!"
set "$val2=!$val2:.=%,!"
set titre=!VrFchRcnt:~0,3!
echo !VrFchRcnt:~%%i,%%j! !VrFchRcnt:~%%k,%%l! !VrFchRcnt:~%%m,%%n! !VrFchRcnt:~%%o,%%p!:!VrFchRcnt:~%%q,%%r!:!VrFchRcnt:~%%s,%%t! !$val1! !$val2!>>!syst!_!annee!_!titre!_test.txt
)
)
)
goto :EOF |
Partager