• Login
Community
  • Login

Run Shift+F5 = Shell execure current file missing after update 7.6.3

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
11 Posts 5 Posters 2.1k 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.
  • O
    Oliver Majchrzak
    last edited by Feb 22, 2019, 12:34 PM

    Dear community Run -> Shift+F5 = Shell execure current file is missing after the current update to 7.6.3. Is it a current issue or a known bug? Else is there a way to fix it manually, since I use it very often.

    1 Reply Last reply Reply Quote 0
    • P
      PeterJones
      last edited by PeterJones Feb 22, 2019, 2:43 PM Feb 22, 2019, 2:41 PM

      I don’t remember the last time “Shell execute current file” was in the Run menu by default. In all my portable copies from 7.2.2 to 7.6.3, I couldn’t find anything from “shell”, “execute”, or “current file” that looked liked “shell execute current file” – my guess is that you (or someone) had customized your shortcuts.xml to include that.

      I have two suggestions for re-creating the behavior I am assuming you mean: Close all instances of Notepad++; open one new instance; open %appdata%\notepad++\shortcuts.xml; edit the <UserDefinedCommands> to include one or both of:

          <Command name="Execute This File" Ctrl="no" Alt="no" Shift="yes" Key="116">cmd /c &quot;$(FULL_CURRENT_PATH)&quot;</Command>
          <Command name="Shell Execute This File" Ctrl="no" Alt="yes" Shift="yes" Key="116">cmd /k &quot;$(FULL_CURRENT_PATH)&quot;</Command>
      

      save the file. Exit notepad++. Re-run notepad++.

      Now one or both of “Execute This File” and/or “Shell Execute This File” will appear in your Run menu – as defined, with the first being Shift+F5 and the second Alt+Shift+F5 (*). The first will run the current file using your default file-association for that file type inside a cmd.exe window, and the window will disappear when the file is done executing; the second will run the current file using your default file-association for that file type inside a cmd.exe window, and the window will remain open after running the file, and you can use that window as a normal windows command-line environment.

      *: you can easily swap those associations when you paste it in by editing the parameters in the <command> tag. Or, after reload, Run > Modify Shortcut / Delete Command, and edit the keyboard shortcut there

      O 1 Reply Last reply Feb 26, 2019, 9:45 AM Reply Quote 2
      • A
        Alan Kilborn
        last edited by Feb 22, 2019, 2:55 PM

        Didn’t there used to be some menu command to open the current file with the “default application”. I can’t find any such option right now, but I seem to remember it. This is what the OP’s “shell execute” phraseology makes me think of.

        1 Reply Last reply Reply Quote 2
        • P
          PeterJones
          last edited by Feb 22, 2019, 3:30 PM

          Yeah, I thought there was, too, but my grep of a wide range of shortcuts.xml versions couldn’t find it. I assume it was implemented similar to what i showed above.

          Going through the change history on shortcuts.xml, I couldn’t find any previous versions that had something similar in shortcuts.xml – so I guess if it was there, it was either really old (pre-github), or was implemented elsewhere than shortcuts.xml/Run-menu

          1 Reply Last reply Reply Quote 1
          • G
            guy038
            last edited by guy038 Feb 22, 2019, 6:21 PM Feb 22, 2019, 6:04 PM

            Hi, @oliver-majchrzak, @alan-kilborn, @peterjones and All,

            Alan, are you searching for this command :

            File > Open in Default Viewer" which opens current file with its default associated application

            BTW, there are, also, these two commands, which may be sometimes useful :

            • File > Open Containing Folder > Explorer , which opens an Explorer instance in the folder of the current file and selects current file

            • File > Open Containing Folder > cmd which opens a CMD console window, in the folder of the current file

            Cheers,

            guy038

            A 1 Reply Last reply Feb 22, 2019, 6:22 PM Reply Quote 3
            • A
              Alan Kilborn @guy038
              last edited by Feb 22, 2019, 6:22 PM

              @guy038 said:

              File > Open in Default Viewer"

              Yes, that’s the one. It doesn’t appear in my older, very STABLE version of N++. Perhaps that is why I could not find it. I guess it is really unrelated to the OP’s OP.

              1 Reply Last reply Reply Quote 2
              • P
                PeterJones
                last edited by Feb 22, 2019, 6:32 PM

                Interesting, I hadn’t noticed that feature when it arrived, so I just went digging through commits and release history.

                That feature was added in commit fbbe934 on Aug 13, 2017, which means it was in v7.5 .

                I love when I learn something new, so thanks @guy038. It’s a little less pleasant when I should have learned it in the past, but it’s better than not learning it. ;-)

                A 1 Reply Last reply Feb 22, 2019, 6:44 PM Reply Quote 2
                • A
                  Alan Kilborn @PeterJones
                  last edited by Feb 22, 2019, 6:44 PM

                  @PeterJones

                  I simply recall it being mentioned recently here in the Community. Nice digging of you to track down its history.

                  1 Reply Last reply Reply Quote 1
                  • O
                    Oliver Majchrzak @PeterJones
                    last edited by Oliver Majchrzak Feb 26, 2019, 9:46 AM Feb 26, 2019, 9:45 AM

                    @PeterJones Thanks for the hint. Though, when executing the current file with “Shift+F5” (in my case a dos batch) the file is executed at the directory “%appdata%\notepad++” where the “shortcuts.xml” file is but not in the path where the current file is (“$(FULL_CURRENT_PATH)”). How can I fix this?

                    M 1 Reply Last reply Feb 26, 2019, 11:28 AM Reply Quote 0
                    • M
                      Meta Chuh moderator @Oliver Majchrzak
                      last edited by Meta Chuh Feb 26, 2019, 11:42 AM Feb 26, 2019, 11:28 AM

                      @Oliver-Majchrzak

                      you can change to your document’s drive letter and path, by adding and combining cd /d "$(CURRENT_DIRECTORY)" followed by && and your desired command.

                      (note: the cd option /d will also change to the correct drive letter (e.g. F:\), if your document is on another drive than c:, like a different hdd, usb, or network drive.)

                      here are @PeterJones shortcuts.xml, <UserDefinedCommands> from above, with added cd commands.

                      		<Command name="Execute This File" Ctrl="no" Alt="no" Shift="yes" Key="116">cmd /c cd /d "$(CURRENT_DIRECTORY)" && "$(FULL_CURRENT_PATH)"</Command>
                      		<Command name="Shell Execute This File" Ctrl="no" Alt="yes" Shift="yes" Key="116">cmd /k cd /d "$(CURRENT_DIRECTORY)" && "$(FULL_CURRENT_PATH)"</Command>
                      
                      1 Reply Last reply Reply Quote 1
                      • P
                        PeterJones
                        last edited by Feb 26, 2019, 2:27 PM

                        @Oliver-Majchrzak ,

                        Alternately, if you’ve got a batch file that critically needs its current directory to be the same as the directory it’s in, that should be handled in the batch file itself. For example,

                        @cd /d %~dp0
                        

                        (note that %~dp0 is using the “parameter extensions” on the %0 (which is the .bat’s pathname) as described at https://ss64.com/nt/syntax-args.html , to extract the drive and path, but not the filename).

                        With that near the beginning of your batch script, you won’t need to change directory externally.

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