SUPINFO International University

SUPINFO Institute of Information Technology
Laboratoire Microsoft




Créez un raccourci vers un dossier à l'aide d'un assistant

Accueil > Script > maintenance > Créez un raccourci vers un dossier à l'aide d'un assistant

Créez un raccourci vers un dossier à l'aide d'un assistant

Par Charles BARJANSKY,
Publiée le 15/04/2005 vers 18h.

Voici un script qui vous permet de créer un raccourci Explorer vers un dossier via un assistant. Le raccourci sera crée dans le même dossier où se trouve le script.

Dim strShortcutPath, strDesktopPath, strCMD, strPrompt
Dim WshShell, objShell, objFolder, objShortcut
strPrompt = "Séléctionnez le dossier pour la création d'un raccourci"
Set WshShell = CreateObject("WScript.Shell")
strCMD = WshShell.ExpandEnvironmentStrings("%WinDir%") & "\EXPLORER.EXE "
strDesktopPath = WshShell.SpecialFolders("Desktop")
On Error Resume Next
Set objShell = WScript.CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(&H0, strPrompt, &H0001, 0)
strShortcutPath = objFolder.ParentFolder.ParseName(objFolder.Title).Path
If Err.Number = 0 Then
Set objShortcut = WshShell.CreateShortcut (strDesktopPath & "\" & objFolder.Title & ".lnk")
objShortcut.TargetPath = strCMD
objShortcut.Arguments = " /e, /root, " & strShortcutPath
objShortcut.Save
If err.Number <> 0 Then
Wscript.Echo err.Number, err.Description
End If
Else
Wscript.Echo "Pas de raccourci crée..."
End If



Proposer un script

Notre avis :

Votre avis :

Réactions :
0

Votants :
10

Visites :
8334

1
2
3
4
5




Retrouvez ci-dessous les autres sections du Laboratoire Microsoft