• Login
Community
  • Login

Execute the Current File in its ASSOCIATED Program

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
5 Posts 3 Posters 1.6k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D
    Dennis Bareis
    last edited by Feb 6, 2022, 9:34 PM

    Is there a way to execute the current file (probably save it first if not) in the associated program or any program for that matter?

    It is not in the “Run” menu so maybe weird hotkey or plugin?

    P 1 Reply Last reply Feb 6, 2022, 11:43 PM Reply Quote 0
    • P
      PeterJones @Dennis Bareis
      last edited by Feb 6, 2022, 11:43 PM

      @dennis-bareis

      Run > Run… > cmd /c "$(FULL_CURRENT_PATH)"

      You can save that command by hitting the Save button in the dialog, give it a name and an optional keyboard shortcut of your choosing.

      The variable syntax for the Run menu is explained in the Configuration File

      D 1 Reply Last reply Feb 7, 2022, 12:11 AM Reply Quote 3
      • D
        Dennis Bareis @PeterJones
        last edited by Feb 7, 2022, 12:11 AM

        @peterjones said in Execute the Current File in its ASSOCIATED Program:

        cmd /c “$(FULL_CURRENT_PATH)”

        Thanks, that seems to work but that command would need more work (for a general solution) as a lot of commands will need the current directory to be set correctly.

        In any case, I found a better solution, there is a plugin called “RunMe” (not sure where the web page is but I used “Plugins Admin” to find and install it. The plugin takes care of the current directory also and has some other niceties.

        P 1 Reply Last reply Feb 7, 2022, 12:52 AM Reply Quote 3
        • P
          PeterJones @Dennis Bareis
          last edited by Feb 7, 2022, 12:52 AM

          @dennis-bareis said in Execute the Current File in its ASSOCIATED Program:

          Thanks, that seems to work but that command would need more work (for a general solution) as a lot of commands will need the current directory to be set correctly.

          That’s why the version I use is actually an NppExec script (save, cd, run) rather than a saved Run command.

          But glad you found something that works for you

          1 Reply Last reply Reply Quote 1
          • G
            guy038
            last edited by guy038 Feb 7, 2022, 1:15 AM Feb 7, 2022, 1:10 AM

            Hello, @dennis-bareis, @peterjones and All,

            Dennis, in order to open various text files with their default program ( Notepad for Windows OS ) you may also use the built-in N++ option File > Open in Default Viewer

            Once opened in N++, I could even opened a PDF file and an 7z archive by this means !

            • The PDF file correctly opened, in my Microsoft Edge software, thanks to its built-in PDF viewer function

            • The 7z archive correctly opened in my 7zFM Manager program

            However, the File > Open in Default Viewer option is greyed out if you try to open any picture ! Luckily, with the @peterjones method, it correctly opens the pictures in the default picture viewer : Photos !

            Best Regards,

            guy038

            1 Reply Last reply Reply Quote 2
            3 out of 5
            • First post
              3/5
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors