[Python] How do I add a new item to the context menu for .url file types?

Discussão em 'Python' iniciado por Stack, Agosto 12, 2025.

  1. Stack

    Stack Membro Participativo

    When adding a custom option to the context menu for different types of icons, this code works fine:

    with reg.CreateKey(reg.HKEY_CURRENT_USER, base_path) as main_key:
    reg.SetValueEx(main_key, 'MUIVerb', 0, reg.REG_SZ, 'New Item')
    with reg.CreateKey(main_key, 'command') as cmd_key:
    reg.SetValue(cmd_key, '', reg.REG_SZ, r'"C:\...\app.exe" "%1"')


    For file types like .txt, .png, etc., I used: base_path = "SOFTWARE\\Classes\\*\\shell\\NewItem" For folders: base_path = "SOFTWARE\\Classes\\Directory\\shell\\NewItem" For .lnk files: base_path = "SOFTWARE\\Classes\\lnkfile\\shell\\NewItem" What base_path should I use for Internet Shortcuts (.url files)? Is there a way to add new item for context menues for Internet Shortcuts? I need the item add only for HKEY_CURRENT_USER.

    I’ve tried:

    base_path = "SOFTWARE\\Classes\\InternetShortcut\\shell"
    // And
    base_path = "SOFTWARE\\Classes\\.url\\shell\\NewItem"


    but that didn’t help

    Continue reading...

Compartilhe esta Página