Problème de passage de variable
Bonjour,
je cherche à récupérer des informations contenus dans un fichier texte.
je suis arriver à toutes les isoler mais je n'arrive pas à les réutiliser.
(en fait je récupère l'identifiant d'un patient, son champ puis je vais dans le chemin : L:\suzanne\Patients\identifiant\champ\tampon.txt )
Voila mon code :
Code:
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
| @echo off
setlocal enableDelayedExpansion
echo on
for /f "tokens=1 delims=+" %%a in (tampon_identifiant.txt) do (
set adresse=%%a
echo adresse : !adresse!
)
for /f "tokens=2 delims=+" %%b in (tampon_identifiant.txt) do (
set champ=%%b
echo champ :!champ!
)
for /f "tokens=4 delims=\-" %%c in (tampon_identifiant.txt) do (
set numero=%%c
echo numero : !numero!
echo L:\suzanne\Patients\%%c\!champ!\tampon.txt
//ici tout marche
)
set chemin = "L:\suzanne\Patients\%numero%\%champ%\tampon.txt"
for /f "tokens=1" %%d in (%chemin%) do (
//il me dit que le chemin est <NULL>...
set bool=%%d
echo bool: !bool!
)
endlocal
pause |
Voila je n'arrive pas à ouvrir le fichier texte car il ne trouve pas le bon chemin...J'ai éssayé avec plein de syntaxes mais je bloque...
Un peu d'aide ? ;)
Merci