execution de commande dans VBS
Bonjour,
mon script est censsé scanner les 4 Premiers niveau d'une arborecence et d'executer une commande SETACL sur chacun d'eux.
envoyer le resultat dans un fichier qui à pour nom le chin du repertoire scanné
probleme j'ai du mal à integrer ma commande dans le script.
Message d'erreur :
Citation:
](31, 44) Erreur de compilation Microsoft VBScript: Fin d'instruction attendue
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
|
Dim oFSO,oFld
Set oFSO = CreateObject("Scripting.FileSystemObject")
stRep = "d:\users"
LectRep stRep
Dim Subnumber,Chemin
Subnumber = 0
'
' Fonction récursive de parcours de répertoire
'
Sub LectRep (stR)
Dim Chemin_def
Do While Subnumber <> 4
For each oFld in oFSO.GetFolder(stR).SubFolders
Subnumber = Subnumber + 1
Chemin = Replace(oFld.Path,"\","-")
Chemin_def = Replace(Chemin,":","_")
Wscript.Echo "--------------- " & oFld.PAth & "-----------------"
WScript.Echo Chemin_def
Commande (oFld.PATH)
LectRep oFld.PATH
Next
Loop
end sub
'
' commande à executer
'
Sub Commande (stR)
Set fso2 = CreateObject("Scripting.FileSystemObject")
set shl = createobject("wscript.shell")
shl.run "cmd /K setacl.exe -on -ot file -actn list -lst f:sddl;w:d,s,o,g;i:n;s:y -rec no -bckp C:\LOGS\ACL\"Chemin_def".txt",0,True
End sub |
Merci de votre aide