Add XY scripts to context menu (Registry method)

Discuss and share scripts and script files...
Post Reply
serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Add XY scripts to context menu (Registry method)

Post by serendipity »

I am sure some of you already know this, but this post motivated me to share it anyway.

This workaround uses Registry hack and XY's command line switch /script to create right-click context menus for folders, files or simply white space inside XYplorer's list.

Note: Below material was gathered from this link from How-to-Geek.
All credits to that post, I am just rephrasing most of that here.

For what its worth here's the disclaimer:
Requires editing Registry. Try this at your own risk.
That said its a pretty harmless tweak and can be reversed easily.

So how to add any XYplorer script to your right-click menu:

For any file type:
1) Go to registry
2) Navigate to HKEY_CLASSES_ROOT\*\shell
3) Right-click on the shell folder and click New>Key
4) There will be a new folder under shell now. Rename it to whatever you want to see in the right-click menu. I will call it "XY greetings"
5) Now right-click on "XY greetings" folder and click New>Key. Again you will see a new folder, rename that as "command".
6) Click on command folder and on the right window you will see a "Default" file.
The folder structure so far is HKEY_CLASSES_ROOT\*\shell\XY greetings\command and file is Default
7) Double click on Default file and in the Value data field paste XY's executable file including path followed by script you want to run.
Example script:

Code: Select all

"C:\\Program files\\XYplorer\\XYplorer.exe" /script="::msg 'Welcome to XY!';" /flg=2
Note how there are double back slashes? I've heard that it matters for some, but single slash worked fine here.

An example with xys script file:

Code: Select all

"C:\\Program files\\XYplorer\\XYplorer.exe" /script="::load Teracopy, copy" /flg=2
For any folder:
Same steps as above but inside: HKEY_CLASSES_ROOT\Directory\shell

For anywhere else in the list (white area):
Same as above but here: HKEY_CLASSES_ROOT\Directory\Background\shell

Note: you have to have this tweak enable for white area context meny

Code: Select all

; Tweak: 0=Edit menu, 1=Folder's shell menu, 2=Favorites, 3=reserved, 4=Tabs
CEA_ListRightClickOnWhite=1
For a specific filetype:
This is bit more longish, you are better off following this post see under "Specific File Types" which has nice images to explain how to do it.

Also, you can make the item appear in the right-click menu only when holding Shift key. After step 5 above the folder structure will be HKEY_CLASSES_ROOT\*\shell\XY greetings. Click on XY greeting folder and on the right window create a new string: right-click>New>String Value and name it "Extended". That's it, now XY greetings will appear on when holding Shift key.

Works great here on Windows 7 32-bit and 64-bit OS. :D

How to use /script switch:
::rtfm "idh_commandlineswitches.htm"

Update: Once you create one set of keys in registry, you can export it and edit the .reg file and keep adding more items to your menu quickly.
Last edited by serendipity on 24 Jan 2013 07:02, edited 2 times in total.

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Add XY scripts to context menu (Registry method)

Post by serendipity »

This code is for Nelson Carvalho from this post:
http://www.xyplorer.com/xyfc/viewtopic. ... 452#p81452
Append date:

Code: Select all

"C:\\Program files\\XYplorer\\XYplorer.exe" /script="::rename b, '*-<datem yyyymmdd>';" /flg=2
Wipe:

Code: Select all

"C:\\Program files\\XYplorer\\XYplorer.exe" /script="::#179;" /flg=2

admin
Site Admin
Posts: 66300
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Add XY scripts to context menu (Registry method)

Post by admin »

Holy shit... :shock: ... aren't computers wonderful toys? :appl:

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

Re: Add XY scripts to context menu (Registry method)

Post by Stefan »

Good idea about using the Registry. :D

You can even carry two *.reg files (or a script) to enable and disable this feature on the fly.
Only downside is you will need admin rights to use this.

Wait, i just take a look on W7-64 and found
HKEY_CURRENT_USER\Software\Classes\*\shell\

It never occurred to me that this key exists too on user base.


Please note that "HKEY_CURRENT_USER" is only for the current logged in windows user.

Post Reply