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
|
@echo off
@cls
if not exist D:\log##%computername%\ (
md D:\log##%computername%\
)
echo. > "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
echo Date de creation: %DATE% >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
echo Heure creation: %time:~0,8% >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
echo Nom utilisateur: %USERNAME% >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
echo Nom ordinateur: %computername% >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
cls
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo ------------------------------------------------Appel du batch------------------------------------------------ >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo *******************************creation de l emplacement reseau******************************* >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@net use T: \\nomserv\dosser1 mdp /user:utilisateur@domaine.extension
@echo creation de l'emplacement reseau traite >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo *******************************Mappage batch(s) dans l'emplacement reseau******************************* >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@set /a nbFichiers=0
@for %%a in (T:\*.bat) do set /a nbfichiers+=1
@echo Calcule du nombre de fichier(s) Batch: %nbfichiers% >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo *******************************appel du fichier test.bat******************************* >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
:newtest
for %%f in (T:\*.bat) do (echo Fichier en traitement : %%f
call :process %%f)
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@echo. >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
@timeout 30
@echo *******************************suppression emplacement reseau******************************* > "C:\Users\Administrateur\desktop\scriptfinaux##%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m .txt"
@echo. >> "C:\Users\Administrateur\desktop\scriptfinaux##%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m .txt"
@net use T: /delete /yes
@echo suppression emplacemement reseau traite >> "C:\Users\Administrateur\desktop\scriptfinaux##%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m .txt"
@echo. >> "C:\Users\Administrateur\desktop\scriptfinaux##%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m .txt"
@echo. >> "C:\Users\Administrateur\desktop\scriptfinaux##%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m .txt"
@echo ******************************* copie fichier log ******************************* > "C:\Users\Administrateur\desktop\scriptfinaux##%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m .txt"
@net use T: \\nomserv\dossier2 mdp /user:nomutilisateur@domaine.extension
copy "D:\log##%computername%\" "T:\" /D /Y
copy "D:\log\" "T:\" /D /Y
@net use T: /delete /yes
@echo Mouvement de fichiers ok >> "C:\Users\Administrateur\desktop\scriptfinaux##%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m .txt"
@echo. >> "C:\Users\Administrateur\desktop\scriptfinaux##%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m .txt"
@echo. >> "C:\Users\Administrateur\desktop\scriptfinaux##%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m .txt"
@echo *******************************Suppression des traces******************************* >> "C:\Users\Administrateur\desktop\scriptfinaux##%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m .txt"
@echo. >> "C:\Users\Administrateur\desktop\scriptfinaux##%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m .txt"
@rmdir C:\sources\ /s /q
@echo suppression du dossier source traite >> "C:\Users\Administrateur\desktop\scriptfinaux##%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m .txt"
@rmdir D:\log\ /s /q
@rmdir D:\log##%computername%\ /s /q
@echo suppression du dossier log traite >> "C:\Users\Administrateur\desktop\scriptfinaux##%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m .txt"
@echo. >> "C:\Users\Administrateur\desktop\scriptfinaux##%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m .txt"
@echo. >> "C:\Users\Administrateur\desktop\scriptfinaux##%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m .txt"
goto end
:process
start %1
@echo appel du fichier %1.bat prit en compte >> "D:\log##%computername%\scriptappel_%computername%##%DATE:~0,2%-%DATE:~3,2%-%DATE:~6,4%##%time:~0,2%h%time:~3,2%m.txt"
:end |