Tester un fichier et quitter un script
Bonjour,
Je débute en vbs, j'ai crée un script qui copie un raccourci d'une base notes sous \All Users\Bureau. Jusqu'ici tout va bien ça fonctionne. Maintenant j'aimerai tester la présence de l'icône et si elle est déjà là quitter le script (pour éviter de le relancer à chaque ouverture de session)...Je bloque, j'utilise :
Code:
1 2 3 4
| Dim oFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("C:\Documents and Settings\All Users\Bureau\.ico") Then
end if |
Mais après ? Je quitte le script (sans pop up) comment ? Je place "If objFSO.FileExists"...en début de script ? suis perdu........
Mon script :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| Dim Shell, DesktopPath, URL, WshNetwork
Set Shell = CreateObject("WScript.Shell")
DesktopPath = Shell.SpecialFolders("AllUsersDesktop")
Set URL = Shell.CreateShortcut(DesktopPath & "\.lnk")
URL.TargetPath = "C:\Program Files\Mozilla Firefox\Firefox.exe"
URL.arguments="http://"
URL.IconLocation = ":\, 0"
URL.WorkingDirectory = "C:\Program Files\Mozilla Firefox"
URL.Save
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set objFileSuccess = objFSO.OpenTextFile("", ForAppending, True)
Tcomputer = WshNetwork.ComputerName
ObjFileSuccess.WriteLine " " & Tcomputer &" le " & date &" à " & time |
Si vous avez une idée je suis preneur........Merci.