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
WshSpecialFolders
WshUrlShortcut
Save
ADSI (WinNT Provider)
WMI
ScriptCenter
Les erreurs Windows
Les trucs et astuces
Télécharger

 

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

Propriétés :

Propriété Description
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.TargetPath Définit le chemin d'accès du fichier exécutable d'un objet de 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