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

  Publicité

  Les scripts Windows
Nom WshSpecialFolders
Type Objet
Description Renvoie les chemins d'accès pour les dossiers environnement de Windows tels que le dossier du bureau, le dossier du menu Démarrer et le dossier des documents personnels.

Propriétés :

Propriété Description
object.Item (natIndex) Renvoie un élément spécifié en provenance d'une collection.
object.Count Renvoie le nombre d'éléments énumérés.
object.Length Renvoie le nombre d'éléments énumérés.

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