| Nom |
WshShell |
| Type |
Objet |
| Description |
Démarre un nouveau traitement, crée des raccourcis et fournit la collection Environment pour la gestion de variables d'environnement telles que WINDIR, PATH ou PROMPT. |
Propriétés :
| Propriété |
Description |
| object.Environment ([strType]) |
Renvoie l'objet WshEnvironment. |
| object.SpecialFolders (objWshSpecialFolders) |
Fournit l'objet WshSpecialFolders pour accéder aux dossiers environnement de Windows tels que le dossier du bureau, le dossier du menu Démarrer et le dossier des documents personnels. |
Application :
Le code suivant illustre comment l'objet WshShell est employé pour créer 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
|