Create REG file to define XYplorer as default file manager

Discuss and share scripts and script files...
Post Reply
admin
Site Admin
Posts: 66249
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Create REG file to define XYplorer as default file manager

Post by admin »

This script creates two REG files pointing to the current XYplorer.exe. You can use the REG files to (un)make it the default file manager for drives and directories.

Needs XYplorer v7.90.0051 or later.
Note that the script is still good for v8.40 and later.

Usage

NOTE: Changing the registry is potentially dangerous. You have been warned.

(1) Start XYplorer.
(2) Browse to some folder where you want to create two *.reg files.
(3) Open menu Scripting / Try Script...
(4) Paste the script below into the Edit box and press OK
(5) Now you see a "Stepping through a script" dialog. Press Continue (about 8 times) until the script is competed and the dialog closes for good.
(6) You now should see two new *.reg files in the current folder: xyfm-reg.reg and xyfm-unreg.reg
(7) Double-Click xyfm-reg.reg to make XYplorer the default file manager for drives and directories.

To go back to Explorer as default file manager double-Click xyfm-unreg.reg.


Code: Select all

"Create REG files"
  // create REG file to define XYplorer as default file manager
  // note: "REGEDIT4" is compatible with Win98 and WinNT4
  // later OSs can use "Windows Registry Editor Version 5.00" instead
  $reg = <<<DOC
REGEDIT4

[HKEY_CLASSES_ROOT\Drive\shell]
@="XYplorer"

[HKEY_CLASSES_ROOT\Drive\shell\XYplorer]
@="Open in XYplorer"

[HKEY_CLASSES_ROOT\Drive\shell\XYplorer\command]
@="\"{xy}\" %1"

[HKEY_CLASSES_ROOT\Directory\shell]
@="XYplorer"

[HKEY_CLASSES_ROOT\Directory\shell\XYplorer]
@="Open in XYplorer"

[HKEY_CLASSES_ROOT\Directory\shell\XYplorer\command]
@="\"{xy}\" %1"
DOC;

  // escape the slashes, and insert
  replace $xy, "<xypath>\<xyexe>", "\", "\\";
  replace $reg, $reg, "{xy}", $xy;
  
  // save file to current path
  writefile("xyfm-reg.reg", $reg);


  // create REG file to restore Explorer as default file manager
  $unreg = <<<DOC
REGEDIT4

[HKEY_CLASSES_ROOT\Drive\shell]
@="none"

[-HKEY_CLASSES_ROOT\Drive\shell\XYplorer]

[HKEY_CLASSES_ROOT\Directory\shell]
@="none"

[-HKEY_CLASSES_ROOT\Directory\shell\XYplorer]
DOC;

  // save file to current path
  writefile("xyfm-unreg.reg", $unreg);

little titty
Posts: 81
Joined: 15 Nov 2009 19:34

Re: Create REG file to define XYplorer as default file manager

Post by little titty »

hmm, wouldnt work for me, when i double clicked on the reg file i just got a message "cannot import error opening the file"
I thought it might be my antivirus prog protecting the registry so turned it off I but no still got same message.
Why doesn't everybody have a great user name like mine?

zer0
Posts: 2676
Joined: 19 Jan 2009 20:11

Re: Create REG file to define XYplorer as default file manager

Post by zer0 »

little titty wrote:hmm, wouldnt work for me, when i double clicked on the reg file i just got a message "cannot import error opening the file"
What OS are you using? Vista and Win 7 need 'Windows Registry Editor Version 5.00' in the declaration instead of 'REGEDIT4'.
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build

little titty
Posts: 81
Joined: 15 Nov 2009 19:34

Re: Create REG file to define XYplorer as default file manager

Post by little titty »

sorry I should have stated the os
I am using xp pro service pack 2
Why doesn't everybody have a great user name like mine?

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Create REG file to define XYplorer as default file manager

Post by Stefan »

little titty wrote:hmm, wouldnt work for me, when i double clicked on the reg file i just got a message "cannot import error opening the file"
Sorry, nothing against you, but just to make this clear:
did you follow the instructions from post No.1 above?
The code above is not an ready-to-use *.reg file but an XYplorer script.

little titty
Posts: 81
Joined: 15 Nov 2009 19:34

Re: Create REG file to define XYplorer as default file manager

Post by little titty »

yes of course i followed the instructions and the script worked fine but on double clicking the reg file produced It wasnt allowed to be added to the registry.
I have now solved that problem by going into the registry and importing from there and it now works fine.
Why doesn't everybody have a great user name like mine?

Post Reply