Run Shift+F5 = Shell execure current file missing after update 7.6.3
Oliver Majchrzak last edited by
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.
PeterJones last edited by PeterJones
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.xmlto 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 "$(FULL_CURRENT_PATH)"</Command> <Command name="Shell Execute This File" Ctrl="no" Alt="yes" Shift="yes" Key="116">cmd /k "$(FULL_CURRENT_PATH)"</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+F5and the second
Alt+Shift+F5(*). The first will run the current file using your default file-association for that file type inside a
cmd.exewindow, 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.exewindow, 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
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.
Yeah, I thought there was, too, but my grep of a wide range of
shortcuts.xmlversions 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
guy038 last edited by guy038
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 > cmdwhich opens a CMD console window, in the folder of the current file
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.
Interesting, I hadn’t noticed that feature when it arrived, so I just went digging through commits and release history.
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. ;-)
I simply recall it being mentioned recently here in the Community. Nice digging of you to track down its history.
Oliver Majchrzak last edited by Oliver Majchrzak
@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?
Meta Chuh last edited by Meta Chuh
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
/dwill 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
<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>
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
%~dp0is 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.