Question 5

Comment créer un raccourci sur le Bureau ?

Le code suivant permet de créer sur le bureau un raccourci vers le lecteur CD :

Set WSHShell = CreateObject("WScript.Shell")

DesktopPath = WSHShell.SpecialFolders("Desktop")

Set Shortcut = WSHShell.CreateShortcut(DesktopPath & "\Lecteur CD.lnk")
With Shortcut
    .TargetPath = WSHShell.ExpandEnvironmentStrings("%windir%\cdplayer.exe")
    .Arguments = "/play"
    .WorkingDirectory = WSHShell.ExpandEnvironmentStrings("%windir%")
    .IconLocation = WSHShell.ExpandEnvironmentStrings("%windir%\cdplayer.exe, 0")
    .Description = "Démarrer le lecteur CD"
    .HotKey = "CTRL+ALT+SHIFT+X"
    .WindowStyle = 4
End With
Shortcut.Save

Date de publication : 07 juillet 2002
Dernière modification : 07 juillet 2002
Rubriques : Windows
Mots-clés : raccourci, bureau