customize file associations, to open files in custom default handler apps

Discussion related to "Everything" 1.5.
Post Reply
searchmaxxer
Posts: 8
Joined: Wed May 14, 2025 4:56 am

customize file associations, to open files in custom default handler apps

Post by searchmaxxer »

(I apologize if this has been answered before. I looked quite thoroughly and couldn't find a similar thread. If it has been answered before, please point me to the appropriate thread.)

I use a lot of portable apps, and have found the Windows 11 default file associations unreliable. E.g., I had set up Irfanview (in portable mode) to view images, but still, sometimes Windows 11 would use its native image viewer to display an image.

So I avoid setting Windows 11 file associations as much as possible. Instead, I use XYPlorer (in portable mode) as my "File Explorer", and use its internal file association tool to set up file associations. So any file I open from within XYPlorer opens in exactly the handler app I want it to open in.

I see that Everything Search App's GUI doesn't seem to have a "customize file associations" tool.

I was wondering if there's some way I could still do it using a script or code.

The goal being that if I search for images (in Everything Search App), and am presented with result a list of images, and double click on an image, it opens in exactly the handler app I want it to open in (Irfanview portable, in the case of images).

Thank You.
horst.epp
Posts: 1642
Joined: Fri Apr 04, 2014 3:24 pm

Re: customize file associations, to open files in custom default handler apps

Post by horst.epp »

Version 1.5 has a Custom open command.
Here you can set associations for extensions.
My config entry look like this
custom_open_commands=[{"name":"Open TC","type":2,"filter"="*.7z;*.zip;*.rar;*.aes;*.jpg;*.zpaq;*.EOC","command"="$exec(\"C:\\Tools\\Wincmd\\Totalcmd64.exe\" /a /o /s \"%1\")"},{"name":"Open AkelPad","type":2,"filter"="*.ini","command"="$exec(\"C:\\Tools\\AkelPad\\AkelPad.exe\" \"%1\")"}]

Use the context menu from a search result entry
to select the entry you want.
searchmaxxer
Posts: 8
Joined: Wed May 14, 2025 4:56 am

Re: customize file associations, to open files in custom default handler apps

Post by searchmaxxer »

Thank you for responding.

I didn't understand this part:
Use the context menu from a search result entry
to select the entry you want.
Below is the context menu I see when I right-click on a search result entry for the search query ".jpg".

How should I use it please? Thanks.

Image
therube
Posts: 5723
Joined: Thu Sep 03, 2009 6:48 pm

Re: customize file associations, to open files in custom default handler apps

Post by therube »

What this does, if I'm understanding correctly, is to add a (right-click) context-menu item (in this case, PIC) that opens particular file types (.jpg, .png, .ico), in a particular program (IrfanView).
.
Everything - Custom Open Commands per file type.png
Everything - Custom Open Commands per file type.png (82.41 KiB) Viewed 7787 times
.
(You'd have to set up wanted file types & paths to your particular programs as they are on your end.)

Now you can also assign hotkeys to custom actions.
Like here, I've set Alt+H to open files in my Hex editor.
You could do similar, say Alt+I to open IrfanView. So anytime you're on a file type that IrfanView can handle, hit Alt+I & it will open in IrfanView.
.
Everything - Custom Open Commands 15a.png
Everything - Custom Open Commands 15a.png (26.57 KiB) Viewed 7787 times


Now, I think you're wanting to simply hit a <CR> on a pic: file-type & have it open in IrfanView (regardless of system defined associations)?



(Heh. And if MS steals file type associations, complain to MS ;-).)
void
Developer
Posts: 19870
Joined: Fri Oct 16, 2009 11:31 pm

Re: customize file associations, to open files in custom default handler apps

Post by void »

As an example, to open jpg files with mspaint:
  • In Everything 1.5, from the Tools menu, click Options.
  • Click the Advanced tab on the left.
  • To the right of Show settings containing, search for:
    open
  • Select: custom_open_commands
  • Set the value to:

    [{"name":"","description":"","include_folders":false,"include_files":true,"filter":"*.jpg","command":"$exec(\"%SYSTEMROOT%\\system32\\mspaint.exe\" \"%1\")"}]


    Click the Edit button to view the JSON table editor.
  • Click OK.
name == (leave blank to make this the default open action)
include_folders == don't include folders.
include_files == include files only.
filter == match jpg files (*.jpg)
command ==
$exec("%SYSTEMROOT%\system32\mspaint.exe" "%1")

Adjust the command to execute Irfanview.

Custom Open Commands
searchmaxxer
Posts: 8
Joined: Wed May 14, 2025 4:56 am

Re: customize file associations, to open files in custom default handler apps

Post by searchmaxxer »

therube wrote: Tue Jul 08, 2025 4:31 pm What this does, if I'm understanding correctly, is to add a (right-click) context-menu item (in this case, PIC) that opens.......
Thank You! ๐Ÿ™ ๐Ÿ™ ๐Ÿ™
searchmaxxer
Posts: 8
Joined: Wed May 14, 2025 4:56 am

Re: customize file associations, to open files in custom default handler apps

Post by searchmaxxer »

void wrote: Wed Jul 09, 2025 1:30 am As an example, to open jpg files with mspaint:...

Thank You! ๐Ÿ™ ๐Ÿ™ ๐Ÿ™
searchmaxxer
Posts: 8
Joined: Wed May 14, 2025 4:56 am

Re: customize file associations, to open files in custom default handler apps

Post by searchmaxxer »

Just posting for future reference.

I had to work with a lot of AI's to get it working for my specific case because I was using Portable Irfanview, and not an installed version. Ultimately, Claude Sonnet 4 came through and gave me what worked:

Code: Select all

[{"name":"IrfanView Portable","description":"Open with IrfanView Portable","include_folders":false,"include_files":true,"filter":"*.jpg;.png;.ico;.bmp;.webp","command":"$exec(C:\\Users\\windows.username\\Desktop\\portable\\IMAGES~1\\IRFANV~1\\IrfanViewPortable.exe %1)"}]
The issue was that there are a lot of spaces in my folder and file names, and they caused issues.

Thank you all!!!
Last edited by searchmaxxer on Thu Aug 07, 2025 4:17 am, edited 1 time in total.
searchmaxxer
Posts: 8
Joined: Wed May 14, 2025 4:56 am

Re: customize file associations, to open files in custom default handler apps

Post by searchmaxxer »

I have a question about how to translate the working version that Claude Sonnet 4 provided (with short names) into a version containing long names with spaces?

I ran into an issue related to 2 things:

1) I use the portable version of Irfanview, so it is not available via "system32\etc. etc."

2) I have many spaces in the path to portable Irfanview.

The path to Irfanview is:

Code: Select all

"C:\Users\user.name\Desktop\portable\images pics photos\IrfanViewPortable (image viewer)\IrfanViewPortable.exe"
Claude Sonnet 4 was able to give me something that works using shortnames (8.3 DOS style names):

Code: Select all

[{"name":"IrfanView Portable","description":"Open with IrfanView Portable","include_folders":false,"include_files":true,"filter":"*.jpg;.png;.ico;.bmp;.webp;.gif","command":"$exec(C:\\Users\\user.name\\Desktop\\portable\\IMAGES~1\\IRFANV~1\\IrfanViewPortable.exe %1)"}]
This works.

However the best that Google Gemini could do was this:

Code: Select all

[{"name":"Open with IrfanView","description":"Opens the selected file in IrfanView Portable","include_folders":false,"include_files":true,"filter":"*.jpg;*.png;.ico;.bmp;.webp","command":"$exec(\"C:\\Users\\user.name\\Desktop\\portable\\images pics photos\\IrfanViewPortable (image viewer)\\IrfanViewPortable.exe\" \"$fullfilename(1)\")"}]
This doesn't work. Google Gemini claims that "the custom_open_commands parser has a fundamental issue with handling quoted paths that contain spaces, causing it to pass the quote character literally to Windows instead of using it to delimit the path".

My question to y'all: Is it possible to translate the working version that Claude Sonnet 4 provided (with short names) into a version containing long names with spaces?
Last edited by searchmaxxer on Thu Aug 07, 2025 4:18 am, edited 1 time in total.
tuska
Posts: 1382
Joined: Thu Jul 13, 2017 9:14 am

Re: customize file associations, to open files in custom default handler apps

Post by tuska »

2searchmaxxer

Hi,
try this solution...ย ย ย ย user.name -> please adjust...

Code: Select all

[{"name":"IrfanView Portable","description":"Open with IrfanView Portable","include_folders":false,"include_files":true,"filter":"*.jpg;*.png;*.ico;*.bmp;*.webp","command":"$exec(\"C:\\Users\\user.name\\Desktop\\portable\\images pics photos\\IrfanViewPortable (image viewer)\\IrfanViewPortable.exe\" \"%1\")"}]
[{"name":"IrfanView Portable","description":"Open with IrfanView Portable","include_folders":false,"include_files":true,"filter":"*.jpg;*.png;*.ico;*.bmp;*.webp","command":"$exec(\"C:\\Users\\user.name\\Desktop\\portable\\images pics photos\\IrfanViewPortable (image viewer)\\IrfanViewPortable.exe\" \"%1\")"}]
therube
Posts: 5723
Joined: Thu Sep 03, 2009 6:48 pm

Re: customize file associations, to open files in custom default handler apps

Post by therube »

Note that in the Edit dialog itself you don't need to \\ the \'s nor escape the ", directly.
You can simply write out a path, "normally", so simply:
C:\Users\user.name\Desktop\portable\images pics photos\IrfanViewPortable (image viewer)\IrfanViewPortable.exe

Now if the path includes spaces, then you do need to quote it:
"C:\Users\user.name\Desktop\portable\images pics photos\IrfanViewPortable (image viewer)\IrfanViewPortable.exe"


and Everything itself "translates" that to what it needs, doubling the \'s & adding the escaping:
\"C:\\Users\\user.name\\Desktop\\portable\\images pics photos\\IrfanViewPortable (image viewer)\\IrfanViewPortable.exe\"


(Or, you could do the doubling & escaping, manually ;-).)


Also note that 8.3 are not necessarily "consistent".
While the given, \\IMAGES~1\\IRFANV~1\\, may have happened to work for you,
It just as well could have been that you would have had to use something like, \\IMAGES~2\\IRFANV~3\\ - depending.
(DIR /X /AD <PATH> would show you the SFN.)
(There are other "gotcha's" with 8.3's.)
searchmaxxer
Posts: 8
Joined: Wed May 14, 2025 4:56 am

Re: customize file associations, to open files in custom default handler apps

Post by searchmaxxer »

therube wrote: Wed Aug 06, 2025 4:04 pm
Holy smokes, you were right... just using the full path with spaces enclosed in double quotes worked!!

Thank you!! ๐Ÿ™๐Ÿ™๐Ÿ™
Post Reply