Bonsoir à tous,
J'ai récupéré un tuto ici destiné à la création d'un fichier bat pour créer un vaccin autorun.inf avec des noms réservé de Windows. Jusque là pas de problème (Il me semble par ailleurs que le sujet est ancien)
Le problème qui réside dans mon bat est qu'il ne créé qu'un seul dossier. L'auteur précise l'ajoute de lignes pour la création de plusieurs dossiers mais ça ne fonctionne pas. Voici ce qu'il préconise:
:nomrep
echo autorun.inf > %temp%\nomrep.txt
echo Nom_du_répertoire_supplémentaire_1 > %temp%\nomrep.txt
echo Nom_du_répertoire_supplémentaire_2 > %temp%\nomrep.txt
echo Nom_du_répertoire_supplémentaire_3 > %temp%\nomrep.txt
goto vaccon
Voici mon bat
chcp 1252
@echo off
del /q %temp%\rapportVacUSB.txt
echo %date% - %time% - Vaccin USB - Gof>%temp%\rapportVacUSB.txt
echo. >>%temp%\rapportVacUSB.txt
goto lecteur
:vaccon
echo Répertoires et fichiers vaccins :>>%temp%\rapportVacUSB.txt
echo. >>%temp%\rapportVacUSB.txt
FOR /f %%g in (%temp%\lecteur.txt) do for /f %%h in (%temp%\nomrep.txt) do (
if exist "%%g\%%h" echo %%g\%%h Present >> %temp%\rapportVacUSB.txt
if exist "%%g\%%h" attrib.exe -h -r -s -a "%%g\%%h"
if exist "%%g\%%h" del /q "%%g\%%h"
rd /s /q "%%g\%%h"
md "%%g\%%h"
type nul > "\?\%%g\%%h\con.Repertoire vaccin"
if exist "\?\%%g\%%h\con.Repertoire vaccin" echo %%g\%%h - Vaccin Ok >> %temp%\rapportVacUSB.txt
attrib.exe +h +r +s +a "%%g\%%h"
)
goto sortie
:sortie
echo.>> %temp%\rapportVacUSB.txt
echo %date% - %time% : Fin.>> %temp%\rapportVacUSB.txt
start %temp%\rapportVacUSB.txt
exit
:lecteur
del /q %temp%\lecteur.txt
echo Lecteur détectés :>>%temp%\rapportVacUSB.txt
echo. >>%temp%\rapportVacUSB.txt
for %%i in (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, y, y, z) do (
vol %%i:
if not errorlevel 1 echo %%i: >>%temp%\lecteur.txt
vol %%i:
if not errorlevel 1 vol %%i: >>%temp%\rapportVacUSB.txt
)
echo. >>%temp%\rapportVacUSB.txt
goto nomrep
:nomrep
echo driver > %temp%\nomrep.txt
echo myfolder > %temp%\nomrep.txt
echo autorun.inf > %temp%\nomrep.txt
goto vaccon
IL NE ME CREE QUE LE DOSSIER AUTORUN MAIS PAS LES AUTRES
PS: j'espère ne pas mettre trompé de forum
Hossec