Page 1 of 1

Create REG file to define XYplorer as default file manager

Posted: 13 Jan 2009 22:03
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);

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

Posted: 29 Dec 2009 17:21
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.

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

Posted: 29 Dec 2009 17:26
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'.

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

Posted: 29 Dec 2009 17:30
by little titty
sorry I should have stated the os
I am using xp pro service pack 2

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

Posted: 29 Dec 2009 17:44
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.

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

Posted: 29 Dec 2009 17:54
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.