2

I'm trying to create a folder with shortcuts in it inside the windows folder "Programs" in the start menu. I've already found a way of creating shorkuts but I can't find a way to locate the "programs" folder in the start menu. For example to find the desktop folder I use:

os.environ["userprofile"]+"\\Desktop\\" 

but I want it with "programs" folder with the programs folder.

Note: I'm not searching for the "Program Files" Folder!!! I'm searching for the folder in the start menu "Programs", that for example in my computer is in "C:\ProgramData\Microsoft\Windows\Start Menu\Programs"

Saúl Pilatowsky-Cameo
  • 1,224
  • 1
  • 15
  • 20

2 Answers2

2

This does it for me:

os.path.join(os.environ["userprofile"], "Start Menu", "Programs")

There's probably a more proper way to do it with the Windows API, but I don't know it.

Edit:

Here are a couple related materials for the Windows API that might help. I don't know the Windows API well enough to make a script for you, though.

Community
  • 1
  • 1
KeJi
  • 288
  • 2
  • 10
  • Nope, for me, that folder doesn't exist... That's a problem, there should be a proper way... maybe in the registry or something like that... – Saúl Pilatowsky-Cameo Jun 26 '11 at 18:12
  • In case you're willing to try out the Windows API in Python, see my answer again. – KeJi Jun 26 '11 at 18:18
  • 1
    I found a solution, in the registry, there is a key named "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" that hast the desktop, programs, start menu etc. I will be able to acces it with the _winreg module. – Saúl Pilatowsky-Cameo Jun 26 '11 at 18:25
  • That's good! If it really works, you can actually post that as an answer to your own question instead of a comment, and accept that answer. – KeJi Jun 26 '11 at 18:27
2

I found a solution, in the registry, there is a key named "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" that has the desktop, programs, start menu etc. I will be able to acces it with the _winreg module.

Saúl Pilatowsky-Cameo
  • 1,224
  • 1
  • 15
  • 20