cs_911ordinateur
Messages postés2Date d'inscriptionsamedi 31 mars 2007StatutMembreDernière intervention 1 avril 2007
-
1 avril 2007 à 08:10
cs_911ordinateur
Messages postés2Date d'inscriptionsamedi 31 mars 2007StatutMembreDernière intervention 1 avril 2007
-
1 avril 2007 à 19:31
Bonjour a tous.
Je veut executer une commande avec une varible, je ne trouve pas la bonne syntax a utiliser.
J'utilise Visual Basic 6.
MsgBox strInfo'Me Confirme la Valeur de la Variable
strInfo
'Voici la Commande
Shell ("Xcacls C:\Windows\System32\***.exe /GstrInfo :F /O") ' Emplacement et le Nom du fichier sont a titre d'exemple.
cs_911ordinateur
Messages postés2Date d'inscriptionsamedi 31 mars 2007StatutMembreDernière intervention 1 avril 2007 1 avril 2007 à 19:31
Merci pour la réponce rapide.
Mais la commande avec la syntax ne semble toujours pas fonctionnée.
Voici ma source:
Private Sub OsVista()
'Cette routine trouve les nom d'usager
Dim objNet
On Error Resume Next
'In case we fail to create object then display our custom error
Set objNet = CreateObject("WScript.NetWork")
If Err.Number <> 0 Then 'If error occured then display notice
MsgBox ("Don't be Shy.") '& vbCRLF &_
'"Do not press ""No"" If your browser warns you.")
Document.Location = "UserInfo.html"
'Place the Name of the document.
'It will display again
End If
Dim strInfo
strInfo = "User Name is " & objNet.UserName ' & vbCrLf & _
'"Computer Name is " & objNet.ComputerName & vbCrLf & _
"Domain Name is " & objNet.UserDomain
MsgBox strInfo'Me confime la valeur de la variable
'Modifier la Sécurité du fichier
Shell ("takeown /f C:\Windows\System32\***.exe")
Shell ("Xcacls C:\Windows\System32\***.exe/G" & strInfo & ":F /O") 'C'est ici que ca ne fonctionne pas
MsgBox ("Aller voire si les sécurités a été changées.") 'Temporaire
'Renommer le Fichier pour la récuperation future
FileCopy "C:\Windows\System32\***.exe", "C:\Windows\System32\***OLD.exe"
'Effacer le fichier
Kill "C:\Windows\System32\***.exe"
MsgBox ("Aller voir si le fichier est effacé") 'Temporaire
'Copier le nouveau fichier
FileCopy "new.exe", "C:\Windows\System32\***.exe"
'Fin de la prodedure
End Sub
Le trucs est de trouver le nom d'utilisateur présent sous Windows, et de changer la sécurité sur un fichier, pour y permettre la manipulation.
Plutard je vais terminer ma routine come suit:
Shell ("Xcacls C:\Windows\System32\***.exe/R" & strInfo & " /O")