Custom Open Commands

Discussion related to "Everything" 1.5.
tuska
Posts: 1374
Joined: Thu Jul 13, 2017 9:14 am

Re: Custom Open Commands

Post by tuska »

2void
Unfortunately, these commands no longer work in Everything 1.5.0.1384a+
EDIT: CODE works(!) - please see solution here.

custom_open_commands

Code: Select all

[{"name":"IrfanView","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\"C:\\totalcmd\\Tools\\IrfanView-portable-64bit\\IrfanView\\i_view64.exe\" \"%1\")"},{"name":"MPC-HC64","type":"2","filter":"*.mp4;*.mov","command":"$exec(\"C:\\Program Files $(x86$)\\K-Lite Codec Pack\\MPC-HC64\\mpc-hc64.exe\" \"%1\")"},{"name":"TC","type":"2","filter":"*.7z;*.zip","command":"$exec(\"C:\\totalcmd\\Totalcmd64.exe\" /O /A /S \"%1\")"}]
Please help.

[{"name":"IrfanView","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\"C:\\totalcmd\\Tools\\IrfanView-portable-64bit\\IrfanView\\i_view64.exe\" \"%1\")"},{"name":"MPC-HC64","type":"2","filter":"*.mp4;*.mov","command":"$exec(\"C:\\Program Files $(x86$)\\K-Lite Codec Pack\\MPC-HC64\\mpc-hc64.exe\" \"%1\")"},{"name":"TC","type":"2","filter":"*.7z;*.zip","command":"$exec(\"C:\\totalcmd\\Totalcmd64.exe\" /O /A /S \"%1\")"}]

________________________________________
Tag
EN: Internal Associations (Everything Only)
DE: Interne Verknüpfungen (nur in Everything)
Last edited by tuska on Sun Dec 01, 2024 3:35 pm, edited 1 time in total.
NotNull
Posts: 5961
Joined: Wed May 24, 2017 9:22 pm

Re: Custom Open Commands

Post by NotNull »

Describe "no longer work" ...

Tested (v1385a) with the following, which is basically your setting with different paths (to programs that exists my system):
Context menu entry Irfanview opens .jpg files
Context menu entry MPC-HC64opens opens .jmp4 files
Context menu entry TC opens opens .7z files

Code: Select all

[{"name":"IrfanView","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\""C:\\Tools\\voidImageViewer.exe"\" \"%1\")"},{"name":"MPC-HC64","type":"2","filter":"*.mp4;*.mov","command":"$exec(\"C:\\Tools\\vlc\\vlc.exe\" \"%1\")"},{"name":"TC","type":"2","filter":"*.7z;*.zip","command":"$exec(\"C:\\Program Files\\7-Zip\\7zFM.exe\" \"%1\")"}]
void
Developer
Posts: 19793
Joined: Fri Oct 16, 2009 11:31 pm

Re: Custom Open Commands

Post by void »

I will consider saving the table editor column positions and widths.

I will also consider making these columns auto fit when first shown.

Thank you for the suggestion.
tuska
Posts: 1374
Joined: Thu Jul 13, 2017 9:14 am

Re: Custom Open Commands

Post by tuska »

tuska wrote: Sat Nov 30, 2024 2:05 pm 2void
Unfortunately, these commands no longer work in Everything 1.5.0.1384a+
NotNull wrote: Sat Nov 30, 2024 7:38 pm Tested (v1385a) with the following, which is basically your setting with different paths (to programs that exists my system):
Context menu entry Irfanview opens .jpg files
Context menu entry MPC-HC64opens opens .jmp4 files
Context menu entry TC opens opens .7z files
I'm very sorry, I mistakenly assumed that, for example, double-clicking on a .PSD file in Everything would open it in IrfanView :?
(In Total Commander there is such a function ... and that confused me).

In Everything, opening a .PSD file with the setting in Advanced > custom_open_commands works via the context menu.
I.e. the CODE is still VALID!
void wrote: Sat Nov 30, 2024 9:16 pm I will consider saving the table editor column positions and widths.
I will also consider making these columns auto fit when first shown.
Thank you in advance for your efforts.
void
Developer
Posts: 19793
Joined: Fri Oct 16, 2009 11:31 pm

Re: Custom Open Commands

Post by void »

I'm very sorry, I mistakenly assumed that, for example, double-clicking on a .PSD file would open it in IrfanView :?
Remove the name or add a duplicated name-less entry:

Everything will use the name-less command as the default command. (open)
Otherwise, the command is shown in the right click context menu.

Code: Select all

[{"name":"","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\""C:\\Tools\\voidImageViewer.exe"\" \"%1\")"},{"name":"MPC-HC64","type":"2","filter":"*.mp4;*.mov","command":"$exec(\"C:\\Tools\\vlc\\vlc.exe\" \"%1\")"},{"name":"TC","type":"2","filter":"*.7z;*.zip","command":"$exec(\"C:\\Program Files\\7-Zip\\7zFM.exe\" \"%1\")"}]
(removed IrfanView name)

-or-

Code: Select all

[{"name":"","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\""C:\\Tools\\voidImageViewer.exe"\" \"%1\")"},{"name":"IrfanView","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\""C:\\Tools\\voidImageViewer.exe"\" \"%1\")"},{"name":"MPC-HC64","type":"2","filter":"*.mp4;*.mov","command":"$exec(\"C:\\Tools\\vlc\\vlc.exe\" \"%1\")"},{"name":"TC","type":"2","filter":"*.7z;*.zip","command":"$exec(\"C:\\Program Files\\7-Zip\\7zFM.exe\" \"%1\")"}]
(duplicated IrfanView without a name)
tuska
Posts: 1374
Joined: Thu Jul 13, 2017 9:14 am

Re: Custom Open Commands

Post by tuska »

2void

Wow, I removed the name “IrfanView” ("name":"",...) from the code and it immediately worked as follows:

Code: Select all

[{"name":"","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\"C:\\totalcmd\\Tools\\IrfanView-portable-64bit\\IrfanView\\i_view64.exe\" \"%1\")"},{"name":"MPC-HC64","type":"2","filter":"*.mp4;*.mov","command":"$exec(\"C:\\Program Files $(x86$)\\K-Lite Codec Pack\\MPC-HC64\\mpc-hc64.exe\" \"%1\")"},{"name":"","type":"2","filter":"*.7z;*.zip","command":"$exec(\"C:\\totalcmd\\Totalcmd64.exe\" /O /A /S \"%1\")"}]
1. Double-clicking the .PSD file in Everything 1.5.0.1385a (x64) opened the file in IrfanView.
2. Right-clicking   the .PSD file in Everything 1.5.0.1385a (x64) and clicking the “Open” context menu item also opened the file in IrfanView.

Thanks for the tip!
________________________________________________
{"name":"","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\"C:\\totalcmd\\Tools\\IrfanView-portable-64bit\\IrfanView\\i_view64.exe\" \"%1\")"},{"name":"MPC-HC64","type":"2","filter":"*.mp4;*.mov","command":"$exec(\"C:\\Program Files $(x86$)\\K-Lite Codec Pack\\MPC-HC64\\mpc-hc64.exe\" \"%1\")"},{"name":"","type":"2","filter":"*.7z;*.zip","command":"$exec(\"C:\\totalcmd\\Totalcmd64.exe\" /O /A /S \"%1\")"}]
tuska
Posts: 1374
Joined: Thu Jul 13, 2017 9:14 am

Re: Custom Open Commands

Post by tuska »

2void
void wrote: Sat Nov 30, 2024 11:37 pm -or-

Code: Select all

[{"name":"","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\""C:\\Tools\\voidImageViewer.exe"\" \"%1\")"},{"name":"IrfanView","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\""C:\\Tools\\voidImageViewer.exe"\" \"%1\")"},{"name":"MPC-HC64","type":"2","filter":"*.mp4;*.mov","command":"$exec(\"C:\\Tools\\vlc\\vlc.exe\" \"%1\")"},{"name":"TC","type":"2","filter":"*.7z;*.zip","command":"$exec(\"C:\\Program Files\\7-Zip\\7zFM.exe\" \"%1\")"}]
(duplicated IrfanView without a name)
I tried the “-or-” option, hoping that “IrfanView” would appear in the context menu
(and a .PSD file could also be opened by double-clicking in IrfanView). Unfortunately, so far without success.

I tried these three variations, but I couldn't get the “IrfanView” context menu entry to appear:

Code: Select all

[{"name":"","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\"C:\\totalcmd\\Tools\\IrfanView-portable-64bit\\IrfanView\\i_view64.exe\" \"%1\")"},"name":"IrfanView","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\"C:\\totalcmd\\Tools\\IrfanView-portable-64bit\\IrfanView\\i_view64.exe\" \"%1\")"},{"name":"MPC-HC64","type":"2","filter":"*.mp4;*.mov","command":"$exec(\"C:\\Program Files $(x86$)\\K-Lite Codec Pack\\MPC-HC64\\mpc-hc64.exe\" \"%1\")"},{"name":"","type":"2","filter":"*.7z;*.zip","command":"$exec(\"C:\\totalcmd\\Totalcmd64.exe\" /O /A /S \"%1\")"}]

Code: Select all

[{"name":"IrfanView","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\"C:\\totalcmd\\Tools\\IrfanView-portable-64bit\\IrfanView\\i_view64.exe\" \"%1\")"},"name":"","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\"C:\\totalcmd\\Tools\\IrfanView-portable-64bit\\IrfanView\\i_view64.exe\" \"%1\")"},{"name":"MPC-HC64","type":"2","filter":"*.mp4;*.mov","command":"$exec(\"C:\\Program Files $(x86$)\\K-Lite Codec Pack\\MPC-HC64\\mpc-hc64.exe\" \"%1\")"},{"name":"","type":"2","filter":"*.7z;*.zip","command":"$exec(\"C:\\totalcmd\\Totalcmd64.exe\" /O /A /S \"%1\")"}]

Code: Select all

[{"name":"IrfanView","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\"C:\\totalcmd\\Tools\\IrfanView-portable-64bit\\IrfanView\\i_view64.exe\" \"%1\")","name":"","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\"C:\\totalcmd\\Tools\\IrfanView-portable-64bit\\IrfanView\\i_view64.exe\" \"%1\")"},{"name":"MPC-HC64","type":"2","filter":"*.mp4;*.mov","command":"$exec(\"C:\\Program Files $(x86$)\\K-Lite Codec Pack\\MPC-HC64\\mpc-hc64.exe\" \"%1\")"},{"name":"","type":"2","filter":"*.7z;*.zip","command":"$exec(\"C:\\totalcmd\\Totalcmd64.exe\" /O /A /S \"%1\")"}]
Please help.
NotNull
Posts: 5961
Joined: Wed May 24, 2017 9:22 pm

Re: Custom Open Commands

Post by NotNull »

tuska wrote: Sun Dec 01, 2024 11:52 am 2void
I tried these three variations, but I couldn't get the “IrfanView” context menu entry to appear:

Code: Select all

[{"name":"","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\"C:\\totalcmd\\Tools\\IrfanView-portable-64bit\\IrfanView\\i_view64.exe\" \"%1\")"},"name":"IrfanView","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\"C:\\totalcmd\\Tools\\IrfanView-portable-64bit\\IrfanView\\i_view64.exe\" \"%1\")"},{"name":"MPC-HC64","type":"2","filter":"*.mp4;*.mov","command":"$exec(\"C:\\Program Files $(x86$)\\K-Lite Codec Pack\\MPC-HC64\\mpc-hc64.exe\" \"%1\")"},{"name":"","type":"2","filter":"*.7z;*.zip","command":"$exec(\"C:\\totalcmd\\Totalcmd64.exe\" /O /A /S \"%1\")"}]
Only void may respond?

Anyway, there's a curly bracket missing in your first JSON, second entry:
,"name":"IrfanView","
should be:
,{"name":"IrfanView","


So try the following instead:

Code: Select all

[{"name":"","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\"C:\\totalcmd\\Tools\\IrfanView-portable-64bit\\IrfanView\\i_view64.exe\" \"%1\")"},{"name":"IrfanView","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\"C:\\totalcmd\\Tools\\IrfanView-portable-64bit\\IrfanView\\i_view64.exe\" \"%1\")"},{"name":"MPC-HC64","type":"2","filter":"*.mp4;*.mov","command":"$exec(\"C:\\Program Files $(x86$)\\K-Lite Codec Pack\\MPC-HC64\\mpc-hc64.exe\" \"%1\")"},{"name":"","type":"2","filter":"*.7z;*.zip","command":"$exec(\"C:\\totalcmd\\Totalcmd64.exe\" /O /A /S \"%1\")"}]

tuska
Posts: 1374
Joined: Thu Jul 13, 2017 9:14 am

Re: Custom Open Commands

Post by tuska »

NotNull wrote: Sun Dec 01, 2024 1:10 pm Only void may respond?
No, I didn't mean it like that at all.
I always welcome your expertise! :)
NotNull wrote: Sun Dec 01, 2024 1:10 pm So try the following instead: ...
Thank you very much! Many thanks also to void!
Your code works perfectly! :)

Menu "Tools" > Options... > Advanced > Show settings containing: custom > custom_open_commands > Value for custom_open_commands:

Code: Select all

[[{"name":"","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\"C:\\totalcmd\\Tools\\IrfanView-portable-64bit\\IrfanView\\i_view64.exe\" \"%1\")"},{"name":"IrfanView","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\"C:\\totalcmd\\Tools\\IrfanView-portable-64bit\\IrfanView\\i_view64.exe\" \"%1\")"},{"name":"MPC-HC64","type":"2","filter":"*.mp4;*.mov","command":"$exec(\"C:\\Program Files $(x86$)\\K-Lite Codec Pack\\MPC-HC64\\mpc-hc64.exe\" \"%1\")"},{"name":"","type":"2","filter":"*.7z;*.zip","command":"$exec(\"C:\\totalcmd\\TOTALCMD64.EXE\" /O /A /S \"%1\")"}]
This makes the following possible:
1. Double-clicking a .PSD file, e.g. in Everything 1.5.0.1385a (x64) to open the file in IrfanView.
   - OR -
2. Right-clicking   a .PSD file, e.g. in Everything 1.5.0.1385a (x64) and clicking the “IrfanViewcontext menu item to open the file in IrfanView.
________________________________________________
[{"name":"","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\"C:\\totalcmd\\Tools\\IrfanView-portable-64bit\\IrfanView\\i_view64.exe\" \"%1\")"},{"name":"IrfanView","type":"2","filter":"*.jpg;*.jpeg;*.psd","command":"$exec(\"C:\\totalcmd\\Tools\\IrfanView-portable-64bit\\IrfanView\\i_view64.exe\" \"%1\")"},{"name":"MPC-HC64","type":"2","filter":"*.mp4;*.mov","command":"$exec(\"C:\\Program Files $(x86$)\\K-Lite Codec Pack\\MPC-HC64\\mpc-hc64.exe\" \"%1\")"},{"name":"","type":"2","filter":"*.7z;*.zip","command":"$exec(\"C:\\totalcmd\\TOTALCMD64.EXE\" /O /A /S \"%1\")"}]
_________________________________________________________________________________________________________

Notes: (Total Commander)

This code (in the last row above) sets the focus to a .7z or .zip file in the active Total Commander panel:
[{"name":"","type":"2","filter":"*.7z;*.zip","command":"$exec(\"C:\\totalcmd\\TOTALCMD64.EXE\" /O /A /S \"%1\")"}]
- after double-clicking the .7z or .zip file, e.g. in Everything 1.5.0.1385a (x64)
- after right-clicking the .7z or .zip file and selecting “Open” from the context menu, e.g. in Everything 1.5.0.1385a (x64)
- after double-clicking the path in Everything 1.5.0.1385a (x64) - SETTING needed (adjust the path if necessary ...):
           Everything Options - 1.5.0.1385a (x64) > Context Menu > Open Path > $exec("C:\totalcmd\TOTALCMD64.EXE" /O /A /S "%1")

This code opens a .7z or .ZIP file in the active Total Commander panel:
[{"name":"","type":"2","filter":"*.7z;*.zip","command":"$exec(\"C:\\totalcmd\\TOTALCMD64.EXE\" /O /S \"%1\")"}]
- after double-clicking the .7z or .zip file, e.g. in Everything 1.5.0.1385a (x64)
- after right-clicking the .7z or .zip file and selecting “Open” from the context menu, e.g. in Everything 1.5.0.1385a (x64)

- AND -

additionally this code can be used to set the focus to a .7z or .zip file in the active Total Commander panel
- after double-clicking the path in Everything 1.5.0.1385a (x64) - SETTING needed (adjust the path if necessary ...):
           Everything Options - 1.5.0.1385a (x64) > Context Menu > Open Path > $exec("C:\totalcmd\TOTALCMD64.EXE" /O /A /S "%1")

This code opens a .7z or .ZIP file in File Explorer:
(This code is generally NOT needed for File Explorer, but only in connection with Total Commander).
[{"name":"Totalcmd","type":"2","filter":"*.7z;*.zip","command":"$exec(\"C:\\totalcmd\\TOTALCMD64.EXE\" /O /A /S \"%1\")"}]
- after double-clicking the .7z or .zip file, e.g. in Everything 1.5.0.1385a (x64)

- AND -

the same code sets the focus to a .7z or .zip file in the active Total Commander panel
- after right-clicking the .7z or .zip file and selecting “Totalcmd” from the context menu, e.g. in Everything 1.5.0.1385a (x64)
- after double-clicking the path in Everything 1.5.0.1385a (x64) - SETTING needed (adjust the path if necessary ...):
           Everything Options - 1.5.0.1385a (x64) > Context Menu > Open Path > $exec("C:\totalcmd\TOTALCMD64.EXE" /O /A /S "%1")

__________________________________________________________________________________
Tags: EN: Internal Associations (Everything Only), DE: Interne Verknüpfungen (nur in Everything)
Windows 11 Pro (x64) Version 24H2 (OS Build 26100.2454) - 2024-11-21
NotNull
Posts: 5961
Joined: Wed May 24, 2017 9:22 pm

Re: Custom Open Commands

Post by NotNull »

tuska wrote: Sun Dec 01, 2024 2:10 pm by tuska » 01 Dec 2024, 15:10

NotNull wrote: ↑01 Dec 2024, 14:10
Only void may respond?

No, I didn't mean it like that at all.
I know you didn't / don't. Should have added a: ;) ...
dedupeit
Posts: 59
Joined: Thu Jul 28, 2022 9:52 pm

Re: Custom Open Commands

Post by dedupeit »

Is there a way to pass all of the results to the command, as opposed to all of the selected files? I going through a workflow where the search results in a small number of files (2 to 10 files as an example). And then I want to run a command against all of the files in the search results.
void
Developer
Posts: 19793
Joined: Fri Oct 16, 2009 11:31 pm

Re: Custom Open Commands

Post by void »

Use
%*
instead of
%1


%*
is replaced with all the selected filenames (space separated)
With
%*
, the command is executed only once.
dedupeit
Posts: 59
Joined: Thu Jul 28, 2022 9:52 pm

Re: Custom Open Commands

Post by dedupeit »

Hey void, thanks for the response. I was actually asking if there was a way to send the list of results as opposed to just the selected files. But I'm using a number of tools to automate my workflow and I've got this taken care of using a different approach :)

BTW, I keep creating things using my suite of tools only to find out that you've already built it into Everything! There so much this does that I don't think I'll ever know it all. Thanks for the great work!
void
Developer
Posts: 19793
Joined: Fri Oct 16, 2009 11:31 pm

Re: Custom Open Commands

Post by void »

Everything 1.5.0.1388a improves custom open commands.

type has been replaced with include_folders and include_files.
description has been added and is shown in the status bar when you hover over this command in the context menu.

Context menu commands have also been improved in this version.
Ralf_Reddings
Posts: 142
Joined: Fri Mar 24, 2023 4:53 pm

Re: Custom Open Commands

Post by Ralf_Reddings »

Am trying to build a custom open command for mpv video player.
I have figured out most things thanks to this thread, am wondering if this is possible with custom commands.
I would like to as well passing the full file path to a command line tool, also pass a everything property to the belonging to the same file.

For example in my everything I have two video files that have a custom property called
timestamp
(achieved via
custom_property0
ini);
I would like to define a custom command that when run will open the selected file in a MPV video player, as if I manually typed in PowerShell/cmd;

Code: Select all

mpv "c:\videoA.mp4" --start=00:03:40
--start=
is a flag belonging to MPV, I would like to pass it the files
timestamp
property. I tried the following everything "command" valu, it worked but the timestamp here is hardcoded;

Code: Select all

$exec("mpv" --start=00:03:40 "%1")
How can I dynamically pass the files
timestamp
property to
$exec()
?


interestingly enough, I tried a snippet that void shared as a solution with someone above, and it worked, I MPV received a jpg file, so can
$exec()
recieve any everything property too?

Code: Select all

$exec("mpv" \"<remove-extension:%1>.jpg\")

am on
Version 1.5.0.1399a (x64)
void
Developer
Posts: 19793
Joined: Fri Oct 16, 2009 11:31 pm

Re: Custom Open Commands

Post by void »

Please try:

$exec("mpv" --start=$customproperty0: "%1")


$customproperty0: is replaced with the timestamp.
It will be blank if the timestamp unknown.
-If that is an issue, use:
$exec("mpv" <iflen:$customproperty0:,"--start="$customproperty0:> "%1")
Ralf_Reddings
Posts: 142
Joined: Fri Mar 24, 2023 4:53 pm

Re: Custom Open Commands

Post by Ralf_Reddings »

thank you void, that was all i needed. also i was able to confirm that using the non-cononical name works too;

Code: Select all

$exec("mpv" --start=$customproperty0: "%1")      #works!
$exec("mpv" --start=$timestamp: "%1")            #works too!
Ralf_Reddings
Posts: 142
Joined: Fri Mar 24, 2023 4:53 pm

Re: Custom Open Commands

Post by Ralf_Reddings »

void wrote: Sun Sep 28, 2025 4:46 am
Regarding
$exec()
, I noticed that a console window is shown (along with whatever window i asked to be opened, such as mpv)
is there a way to explicitly tell
$exec()
to not show a console window at all?

As a test I tried to get a solution working by calling pwsh with
-WindowStyle hidden
;
[code]$exech(pwsh -NoProfile -WindowStyle hidden -Command mpv %1)[/code]


but the console window is still shown for a  second and then hidden (I think by PowerShell)
even then launching pwsh is slow so it would be ideal to do this directly with
exec()
void
Developer
Posts: 19793
Joined: Fri Oct 16, 2009 11:31 pm

Re: Custom Open Commands

Post by void »

Please try executing mpv.exe directly:

$exec("C:\Program Files\mpv\mpv.exe" --start=$customproperty0: "%1")
Ralf_Reddings
Posts: 142
Joined: Fri Mar 24, 2023 4:53 pm

Re: Custom Open Commands

Post by Ralf_Reddings »

I had no idea you could do that, this prety much puts an end to undesired console windows in everything and beyond... I think, very usefull to say the least.

Thank you void, you are a genius.
albino
Posts: 15
Joined: Mon Jun 19, 2023 5:02 pm

Re: Custom Open Commands

Post by albino »

I wonder if somebody can help me construct a basic line to pass multiple files to a batch script. I'm not sure if the first post hasn't been updated, but I can't seem to get any of the code snippets to work. Here's a basic line showing what I'm testing:

Code: Select all

[{"name":"EXAMPLE","type":2,"filter"="*.mkv;*.mp4;","command"="$exec(\"C:\\Program Files (x86)\\Batch Scripts\\Convert Example.bat\" \"%1*\")"}]
I'm pasting that into Options -> Advanced -> custom_open_command01. Then I find a folder with an mkv file and try to open or right-click on it, but I don't see any text that says EXAMPLE.

This is using 1.5.0.1399a with Windows 11. Thanks.
void
Developer
Posts: 19793
Joined: Fri Oct 16, 2009 11:31 pm

Re: Custom Open Commands

Post by void »

Please try the
custom_open_commands
advanced setting.

Please use
%*
to pass all files to one call.

Code: Select all

[{"name":"EXAMPLE","type":2,"filter"="*.mkv;*.mp4;","command"="$exec(\"C:\\Program Files (x86)\\Batch Scripts\\Convert Example.bat\" \"%*\")"}]
albino
Posts: 15
Joined: Mon Jun 19, 2023 5:02 pm

Re: Custom Open Commands

Post by albino »

Thanks for the reply!

I didn't realize that custom_open_commands was its own thing with its own advanced settings, I thought you added each one to each command, so that makes a lot more sense.

One thing I noticed is a quirk with how Batch operates, where if you launch a batch file from Everything it has a different Current Directory than if you drag and drop onto the batch file or use something like Windows Send To. To test this, I made a very simple batch file that just spits out the current directory:

Code: Select all

@echo off

echo Current Directory is: %CD%

pause
If you drag and drop a random file into it you get the location of the file you dropped, similarly if you use the Windows Send To you also get the location of the file, however, if you use Everything's Custom Open Command you get the location of the .bat file.

For example, using D:\Folder\file.mkv the results are:

Code: Select all

Drag & Drop: D:\Folder
Send To: D:\Folder
Everything: C:\Program Files (x86)\Batch Scripts
Other than that, this is a really cool feature. It could almost completely replace Send To if you could nest a bunch of things into a cascading submenu, especially because you can dial down to specific file types unlike Windows giving you way more flexibility.
void
Developer
Posts: 19793
Joined: Fri Oct 16, 2009 11:31 pm

Re: Custom Open Commands

Post by void »

however, if you use Everything's Custom Open Command you get the location of the .bat file.
I cannot change this behavior.
To many scripts depend on the bat location being the current working directory.

I recommend making your bat file set the current working directory to the parent location from %1.
albino
Posts: 15
Joined: Mon Jun 19, 2023 5:02 pm

Re: Custom Open Commands

Post by albino »

void wrote: Sun Oct 05, 2025 10:55 pmI cannot change this behavior.
To many scripts depend on the bat location being the current working directory.

I recommend making your bat file set the current working directory to the parent location from %1.
Easy enough, thank you!
void
Developer
Posts: 19793
Joined: Fri Oct 16, 2009 11:31 pm

Re: Custom Open Commands

Post by void »

Everything 1.5.0.1407a removes the need to use $exec(...)

You can now specify commands as your would in the registry, eg:

Code: Select all

%SystemRoot%\explorer.exe /n,/e,/select,"%1"


$exec(...) and other $functions() will continue to work.
WKen
Posts: 9
Joined: Mon May 15, 2023 5:11 pm

Re: Custom Open Commands

Post by WKen »

Great feature! :)
tuska
Posts: 1374
Joined: Thu Jul 13, 2017 9:14 am

Re: Custom Open Commands

Post by tuska »

Hi,

Everything Options - 1.5.0.1407a (x64) > Advanced > custom_open_commands > Edit...

Code: Select all

$exec("C:\Program Files $(x86$)\K-Lite Codec Pack\MPC-HC64\mpc-hc64.exe" "%1")	-> works!
"C:\Program Files $(x86$)\K-Lite Codec Pack\MPC-HC64\mpc-hc64.exe" "%1"		-> does NOT work *)

Code: Select all

Name		description:					include_files	filter:		command:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
MPC-HC64	Open files in MPC-HC64 instead of Media Player		✅	*.mp4;*.mov	$exec("C:\Program Files $(x86$)\K-Lite Codec Pack\MPC-HC64\mpc-hc64.exe" "%1")
MPC-HC64	Open files in MPC-HC64 instead of Media Player		✅	*.mp4;*.mov	"C:\Program Files $(x86$)\K-Lite Codec Pack\MPC-HC64\mpc-hc64.exe" "%1"
*) How would you define what makes it work?
void
Developer
Posts: 19793
Joined: Fri Oct 16, 2009 11:31 pm

Re: Custom Open Commands

Post by void »

Remove the $( and $) escapes:

Code: Select all

"C:\Program Files (x86)\K-Lite Codec Pack\MPC-HC64\mpc-hc64.exe" "%1"
tuska
Posts: 1374
Joined: Thu Jul 13, 2017 9:14 am

Re: Custom Open Commands

Post by tuska »

void wrote: Thu Mar 12, 2026 11:02 pm Remove the $( and $) escapes:

Code: Select all

"C:\Program Files (x86)\K-Lite Codec Pack\MPC-HC64\mpc-hc64.exe" "%1"
Thanks a lot!   :)
(I don't know why it didn't work for me yesterday).
 
2026-03-13_custom_open_commands.png
2026-03-13_custom_open_commands.png (63.49 KiB) Viewed 3259 times
Post Reply