Se : erreur de compilation Microsoft VBScript: Attendu")'

Je suis nouveau sur le vb script et que vous voulez créer un raccourci pour mon .exe de l'application qui va ouvrir dans une fenêtre invisible. Voici le code que j'ai écrit

Option Explicit

Private Sub Command1_Click()
'This will Create a ShortCut of test_application in our desktop, its name is "My-Test",    invisible windows when run, use the 2nd icon as the Shortcut icon.'

Create_ShortCut "C:\MyApp\bin\test_application.exe", "Desktop", "My-Test", , 0, 1
End Sub

Sub Create_ShortCut(ByVal TargetPath As String, ByVal ShortCutPath As String, ByVal    ShortCutname As String, Optional ByVal WorkPath As String, Optional ByVal Window_Style As Integer, Optional ByVal IconNum As Integer)

Dim VbsObj As Object
Set VbsObj = CreateObject("WScript.Shell")

Dim MyShortcut As Object
ShortCutPath = VbsObj.SpecialFolders(ShortCutPath)
Set MyShortcut = VbsObj.CreateShortcut(ShortCutPath & "\" & ShortCutname & ".lnk")
MyShortcut.TargetPath = TargetPath
MyShortcut.WorkingDirectory = WorkPath
MyShortcut.WindowStyle = Window_Style
MyShortcut.IconLocation = TargetPath & "," & IconNum
MyShortcut.Save

End Sub

Je suis stocké le script de test.vbs et exécutée de la façon suivante

C:\Users\me\Desktop>cscript test.vbs

et me donne l'erreur suivante

Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Users\me\Desktop\test.vbs(9, 38) Microsoft VBScript compilation error: Expected ')'

Est-ce un bon moyen de créer un raccourci ou est-il mieux et plus verbeux pour le faire ?

InformationsquelleAutor msd_2 | 2013-09-19