Accéder à C:\Documents and Settings\All Users\Menu Démarrer\Programmes

Résolu
VbNicoG Messages postés 127 Date d'inscription vendredi 27 juin 2008 Statut Membre Dernière intervention 6 septembre 2019 - 28 oct. 2008 à 10:59
VbNicoG Messages postés 127 Date d'inscription vendredi 27 juin 2008 Statut Membre Dernière intervention 6 septembre 2019 - 28 oct. 2008 à 14:46
Bonjour à tous,

J'aimerais accéder au dossier C:\Documents and Settings\All Users\Menu Démarrer\Programmes sur PC toutes langues.
Existe t'il une variable d'environnement qui connaît ce chemin ?
Voilà ce que je fais pour le moment :
Environment.GetEnvironmentVariable("ALLUSERSPROFILE") mais ALLUSERSPROFILE mène à C:\Documents and Settings\All Users seulement.
Des idées ?

Merci

7 réponses

VbNicoG Messages postés 127 Date d'inscription vendredi 27 juin 2008 Statut Membre Dernière intervention 6 septembre 2019
28 oct. 2008 à 14:05
Sinon, c'est pas terrible mais je peux faire comme ça :
s2 = Environment.GetFolderPath(Environment.SpecialFolder.Programs)
s3 = s2.Replace(Environment.UserName, "All Users")

Si quelqu'un a mieux je suis preneur

Merci
3
gillardg Messages postés 3275 Date d'inscription jeudi 3 avril 2008 Statut Membre Dernière intervention 14 septembre 2014 2
28 oct. 2008 à 14:27
Bonjour,

Dim path1, path2
As
String

Dim isp()
As
Stringpath1 = Environment.GetEnvironmentVariable(

"ALLUSERSPROFILE")path2 = IO.Path.GetFullPath(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu))

isp = path2.Split(

"")path2 = isp(isp.GetUpperBound(0))

MsgBox(IO.Path.Combine(path1, path2))

a+
3
VbNicoG Messages postés 127 Date d'inscription vendredi 27 juin 2008 Statut Membre Dernière intervention 6 septembre 2019
28 oct. 2008 à 14:46
Oui, ou encore
Dim path as string
Dim WSHShell as object
WSHShell = CreateObject("Wscript.Shell")
path = WSHShell.SpecialFolders("AllUsersPrograms")

Bref, plein de façons de le faire...Merci bien gillardg
3
gillardg Messages postés 3275 Date d'inscription jeudi 3 avril 2008 Statut Membre Dernière intervention 14 septembre 2014 2
28 oct. 2008 à 11:40
Bonjour,

puisque tu as déja cela c'est un bon début




path1= Environment.GetEnvironmentVariable("ALLUSERSPROFILE")


maintenant utilise   path2=IO.Path.GetDirectoryName(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu))

ainsi tu auras le nom du répertoire "startMenu"

ensuite
IO.Path.Combine(path1, path2)

a+
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
VbNicoG Messages postés 127 Date d'inscription vendredi 27 juin 2008 Statut Membre Dernière intervention 6 septembre 2019
28 oct. 2008 à 12:24
Impeccable!!
je peux même y accéder directement : Path.GetFullPath(Environment.GetFolderPath(Environment.SpecialFolder.Programs))

Je te remercie
0
gillardg Messages postés 3275 Date d'inscription jeudi 3 avril 2008 Statut Membre Dernière intervention 14 septembre 2014 2
28 oct. 2008 à 13:10
Bonjour,

Path.GetFullPath(Environment.GetFolderPath(Environment.SpecialFolder.Programs))
te donne le path vers username startmenu programs

pas vers all users

a+
0
VbNicoG Messages postés 127 Date d'inscription vendredi 27 juin 2008 Statut Membre Dernière intervention 6 septembre 2019
28 oct. 2008 à 13:56
Exact, je m'en suis rendu compte, mais le fait de combiner ne marche pas non plus! Le résultat de la combinaison renvoie le dossier du username et pas allusers.
Du coup, ce n'est pas encore résolu....
je cherche...si tu trouves...
0
Rejoignez-nous