• Adding to the right-click “new” menu

    Home » Forums » AskWoody support » Windows » Windows 10 » Questions: Win10 » Adding to the right-click “new” menu

    • This topic has 6 replies, 3 voices, and was last updated 3 years ago.
    Author
    Topic
    #2437700

    I have installed Python on my win10/pro/21H2.  I’m pretty sure there is some registry-hacking magic to make that happen, but I haven’t a clue.  Long long ago i added a ‘new’ for perl programs and it even initializes the .pl file from a “template” I set up for it.   Is how to do that explained somewhere?

    Viewing 3 reply threads
    Author
    Replies
    • #2437703

      Python should now be in the path and you should be able to run it by typing “python” in a command prompt.
      If this works, type “path” to find the location of the Python executable.
      Now you can create a shortcut on your Desktop using the path and executable name.

      cheers, Paul

      • #2437748

        You misunderstood — the path is set up perfectly for Python.  What I want is an entry in the “new” context menu in Explorer to _create_ a new python file.   Right now, in addition to “folder” and “shortcut”, I can create a new text file, a new Word doc,  new Excel workbook, etc, etc.   I’m trying to figure out how to add to that list for a new “python program”.

    • #2437761

      Start Regedit

      Navigate to Computer\HKEY_CLASSES_ROOT\.py

      Right click the .py key in the “left-hand” panel and select New > Key and name it ShellNew

      Right click in the “right-hand” panel and select New > String Value and name it NullFile

      Right click NullFile and set its value to 1

      If you have a “blank” Python script template you want to open in Python when you select New, use FileName instead of NullFile and set its value to the path where the template is located.

      • #2438014

        That looks good [and I can actually understand it] but it doesn’t match my system.   The only .py key in my registry is

        ComputerHKEY_CLASSES_ROOTLocal SettingsSoftwareMicrosoftWindowsCurrentVersionAppModelPackageRepositoryPackagesPythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0!Pythonwindows.fileTypeAssociation.pypy

        and it has the keys.  Is this because I didn’t really “install” python but got it from the microsoft store [and in any event should I try the registry changes you suggested]

         

    • #2438117

      Are you sure there is no .py key. See the attached screenshot (it’s not on my machine, but I haven’t installed Python).

      Capture-1

      cheers, Paul

    • #2438140

      Here’s a screen shot from my Win10 Pro 21H2 (OS Build 19044.1586) with the above registry entries added.

      RegEdit

      Here’s what the “New” context menu looked like after I added them.

      NewContextMenu

      Here’s what the “New” context menu looked like when I deleted them.

      NewContextMenu1

    Viewing 3 reply threads
    Reply To: Adding to the right-click “new” menu

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: