Fournit l'objet WshSpecialFolders pour l'accès aux dossiers environnement de Windows tels que le dossier du bureau, le dossier du menu Démarrer et le dossier de documents personnels.
object.SpecialFolders(objWshSpecialFolders)
object
Objet WshShell.
objWshSpecialFolders
Nom du dossier spécial à renvoyer.
Renvoie NULL si le dossier requis (strFolderName) n'est pas disponible. Par exemple, Windows 95 ne possède pas de dossier AllUsersDesktop et renvoie donc NULL si strFolderName = AllUsersDesktop.
Les dossiers spéciaux suivants sont fournis sous Windows 95 et Microsoft Windows NT 4.0 :
AllUsersDesktop
AllUsersStartMenu
AllUsersPrograms
AllUsersStartup
Bureau
Favorites
Fonts
MyDocuments
NetHood
PrintHood
Programs
Récent
SendTo
StartMenu
Startup
Templates
L'exemple suivant illustre l'utilisation d'un fichier .wsf unique pour deux tâches dans différents langages de script (VBScript et JScript). La fonctionnalité de ces deux tâches est identique : chacune crée un raccourci pointant vers le script en cours d'exécution et un raccourci d'URL pointant vers www.microsoft.com :
<package>
<job id="vbs">
<script language="vbscript">
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
</script>
</job>
<job id="js">
<script language="javascript">
var WshShell = new ActiveXObject("WScript.Shell");
strDesktop = WshShell.SpecialFolders("Desktop");
var 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();
var oUrlLink = WshShell.CreateShortcut(strDesktop + "\\Microsoft Web Site.url");
oUrlLink.TargetPath = "http://www.microsoft.com";
oUrlLink.Save();
</script>
</job>
</package>
Pour plus d'informations, reportez-vous à la rubrique Exécution de vos scripts.
Application : WshShell, objet