PUB

  Sommaire
Le registre de Windows
Les API Windows
Les fichiers de stratégie
Les fichiers INF
Les lignes de commandes
Les scripts Windows
VBS
WSH
WshShell
WshEnvironment
WshNetwork
WshShortcut
WindowStyle
Save
WshSpecialFolders
WshUrlShortcut
ADSI (WinNT Provider)
WMI
ScriptCenter
Les erreurs Windows
Les trucs et astuces
Télécharger

  Publicité

  Les scripts Windows
Nom WshShortcut
Type Objet
Description Crée une référence d'objet à un raccourci.

Propriétés :

Propriété Description
object.Arguments Renvoie un pointeur vers la collection WshArguments ou identifie des arguments pour le raccourci pointant vers la collection.
object.Description Fournit une Description d'un objet de raccourci.
object.FullName Renvoie une chaîne contenant le chemin d'accès complet du fichier exécutable de l'hôte ou d'un objet de raccourci.
object.Hotkey = strHotkey Fournit la touche de raccourci d'un objet raccourci. Une touche de raccourci est un raccourci clavier qui lance ou qui bascule vers un programme.
object.IconLocation = strIconLocation Fournit l'emplacement de l'icône d'un objet raccourci.
object.TargetPath Définit le chemin d'accès du fichier exécutable d'un objet de raccourci.
object.WindowStyle = intWindowStyle Fournit le style de fenêtre d'un objet raccourci.
object.WorkingDirectory = strWorkingDirectory Fournit le répertoire de travail d'un objet raccourci.

Application :

Le code suivant crée un raccourci pointant vers le script en cours d'exécution et un raccourci d'URL pointant vers www.microsoft.com.

   set WshShell = WScript.CreateObject("WScript.Shell")
   strDesktop = WshShell.SpecialFolders("Desktop")
   set oShellLink = WshShell.CreateShortcut(strDesktop & "\Shortcut Script.lnk")
   oShellLink.TargetPath = WScript.ScriptFullName
   oShellLink.WindowStyle = 1
   oShellLink.Hotkey = "CTRL+SHIFT+F"
   oShellLink.IconLocation = "notepad.exe, 0"
   oShellLink.Description = "Raccourci script"
   oShellLink.WorkingDirectory = strDesktop
   oShellLink.Save

   set oUrlLink = WshShell.CreateShortcut(strDesktop & "\Microsoft Web Site.url")
   oUrlLink.TargetPath = "http://www.microsoft.com"
   oUrlLink.Save