Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

Add Command in Context Menu?


  • Please log in to reply
28 replies to this topic

#1
kbdavis

kbdavis

    Newbie

  • Member
  • 10 posts
  • Joined 25-February 13
  • OS:Windows 7 x64
  • Country: Country Flag
I need help adding a command to print the directory to the context menu (the right-click menu).

I have created a .bat file in the windows directory with the following information:

@echo off
dir %1 /-p /o:gn > “%temp%\Listing”
start /w notepad /p “%temp%\Listing”
del “%temp%\Listing”
exit

Now I just need to figure out the option to execute this .bat file by right-clicking in the directory I want to print.

Any ideas?

Edited by kbdavis, 25 February 2013 - 10:39 PM.



How to remove advertisement from MSFN

#2
jumper

jumper

    2014 All-American Masters HJ'er

  • Member
  • PipPipPip
  • 476 posts
  • Joined 21-January 11
  • OS:98SE
  • Country: Country Flag
Take a look in HKEY_CLASSES_ROOT\Directory\shell (or similar) for an example to copy.

If the batch file is named printdir.bat, it might look something like this:
REGEDIT4

[HKEY_CLASSES_ROOT\Directory\shell\Print]
@="&Print Directory"

[HKEY_CLASSES_ROOT\Directory\shell\Print\command]
@="C:\\WINDOWS\\printdir.bat \"%1\""

Edit: Added missing "REGEDIT4" to sample for clarity.

Edited by jumper, 15 March 2013 - 10:49 PM.

Design feedback requested:
IHAtool - IpHlpApi tester; call various functions and report results
--status-> framework is solid; 22 api's fully supported; preview release coming soon
ComDlg32 wrapper - ComDlgEx meets IpHlpApi wrapper
--status-> PrintDlgExW working in latest SumatraPDF 8^)
Future projects: ImportPatcher40 - dialog interface; Kexter - IP40+Ktree+Kexstubs

#3
CharlotteTheHarlot

CharlotteTheHarlot

    MSFN Master

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,054 posts
  • Joined 24-September 07
  • OS:none specified
  • Country: Country Flag
Right now I can't find an older post I made about this, but I was researching this a while back. There are two main methods ...

[HKEY_LOCAL_MACHINE\Software\Classes\Directory\Shell\xxx]
[HKEY_LOCAL_MACHINE\Software\Classes\Folder\Shell\xxx]


It looks to me that using FOLDER is preferable because I am pretty sure that DIRECTORY is not processed when right-clicking hidden/system folders.

Furthermore, I noticed that on Win9x, when using both methods they appear consecutively in the list. By inserting a label into dummy entries I was able to get horizontal lines to show up directly inside the right-click menu, and this is roughly how Win9x displayed it ...

===[ BEGIN Shell:Directory ]==================
item
item
item
===[ END Shell:Directory ]==================
===[ BEGIN Shell:Folder ]=====================
item
item
item
===[ END Shell:Folder ]=====================


However, on WinXP, so far the label for DIRECTORY does not show up, but the label for FOLDER does. Interestingly, the items are co-mingled together. I will need more time to experiment though. Consider these preliminary observations. I'll try to get some screenshots next time.

... Let him who hath understanding reckon the Number Of The Beast ...


#4
kbdavis

kbdavis

    Newbie

  • Member
  • 10 posts
  • Joined 25-February 13
  • OS:Windows 7 x64
  • Country: Country Flag

Take a look in HKEY_CLASSES_ROOT\Directory\shell (or similar) for an example to copy.

If the batch file is named printdir.bat, it might look something like this:

[HKEY_CLASSES_ROOT\Directory\shell\Print]
@="&Print Directory"

[HKEY_CLASSES_ROOT\Directory\shell\Print\command]
@="C:\\WINDOWS\\printdir.bat \"%1\""

I attempted this method, also using the other poster's method with the "folder" instead of directory, with no success. Any troubleshooting ideas?

*By the way, thanks for the quick response for both posters!

EDIT:
Please note that your method may work, I just have limited knowledge of editing the registry and I may have made the error with the execution part.

Edited by kbdavis, 09 March 2013 - 11:44 PM.


#5
CharlotteTheHarlot

CharlotteTheHarlot

    MSFN Master

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,054 posts
  • Joined 24-September 07
  • OS:none specified
  • Country: Country Flag

I attempted this method, also using the other poster's method with the "folder" instead of directory, with no success. Any troubleshooting ideas?

Please post the exact registry scripts you tried. Usually it is just a matter of getting the quotes and backslash characters "escaped" correctly. This just means using the proper syntax so that REGEDIT actually inserts the expected string into the registry.

... Let him who hath understanding reckon the Number Of The Beast ...


#6
kbdavis

kbdavis

    Newbie

  • Member
  • 10 posts
  • Joined 25-February 13
  • OS:Windows 7 x64
  • Country: Country Flag

I attempted this method, also using the other poster's method with the "folder" instead of directory, with no success. Any troubleshooting ideas?

Please post the exact registry scripts you tried. Usually it is just a matter of getting the quotes and backslash characters "escaped" correctly. This just means using the proper syntax so that REGEDIT actually inserts the expected string into the registry.

I attached a couple of screen shots to show you how I applied the registry edits.

Attached Files



#7
CharlotteTheHarlot

CharlotteTheHarlot

    MSFN Master

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,054 posts
  • Joined 24-September 07
  • OS:none specified
  • Country: Country Flag

I attached a couple of screen shots to show you how I applied the registry edits.

It's exactly like I said, the error is in the REG script ( or you manually entered the REG script text ). The 2nd left photo clearly shows the error right away with the doubled backslashes and other stuff.

For those to exist as they appear in the photo, you either literally entered the escaped ( double backslash ) strings from the REG text file into the registry via the REGEDIT dialog boxes, or, your imported REG text file actually has quadruple backslashes "\\\\". If you were to now export that key you will see them.

Anyway, this is what you now should import into REGEDIT ( don't copy/paste the lines into REGEDIT! ) ...

REGEDIT4

[-HKEY_CLASSES_ROOT\Directory\Shell\Print]
[HKEY_CLASSES_ROOT\Directory\Shell\Print]
@="&Print Directory"
[HKEY_CLASSES_ROOT\Directory\Shell\Print\Command]
@="\"C:\\Windows\\Printdir.bat\" \"%1\""


I repeat, that chunk of text should be saved as a .REG file and then imported ( or dropped onto ) REGEDIT.

P.S. I would personally use "FOLDER" instead of "DIRECTORY".

EDIT: correction, I meant the 1st photo has the incorrect \Command] strings.

Edited by CharlotteTheHarlot, 12 March 2013 - 07:20 PM.

... Let him who hath understanding reckon the Number Of The Beast ...


#8
kbdavis

kbdavis

    Newbie

  • Member
  • 10 posts
  • Joined 25-February 13
  • OS:Windows 7 x64
  • Country: Country Flag
Thanks for the tip and the quick reply. The registry edit is working now.

Now I have a new problem

See the attached screenshot of the issue. We know that the registry tweak worked because it directed to the PrintDir.bat file and actually managed to open notepad as instructed. So, I believe my issue now lies in the instruction block of the PrintDir.bat file. Below I have put in the code of the file, and would like to know if you know a way to tweak this the proper way...

@echo off
dir %1 /-p /o:gn > “%temp%\Listing”
start /w notepad /p “%temp%\Listing”
del “%temp%\Listing”
exit

Thanks for all the help, we are getting somewhere now!

Attached Files

  • Attached File  1.gif   342.72KB   16 downloads


#9
jumper

jumper

    2014 All-American Masters HJ'er

  • Member
  • PipPipPip
  • 476 posts
  • Joined 21-January 11
  • OS:98SE
  • Country: Country Flag
Remove the angled double-quotes. This works for me:
@echo off
dir %1 /-p /o:gn > %temp%\Listing
start /w notepad /p %temp%\Listing
del %temp%\Listing
exit
Use normal double-quotes if your temp path has a space in it (mine doesn't).

Tip: don't use @echo off when debugging!

Also: I second the recommendation to try using "Folder" instead of "Directory" again.
Design feedback requested:
IHAtool - IpHlpApi tester; call various functions and report results
--status-> framework is solid; 22 api's fully supported; preview release coming soon
ComDlg32 wrapper - ComDlgEx meets IpHlpApi wrapper
--status-> PrintDlgExW working in latest SumatraPDF 8^)
Future projects: ImportPatcher40 - dialog interface; Kexter - IP40+Ktree+Kexstubs

#10
CharlotteTheHarlot

CharlotteTheHarlot

    MSFN Master

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,054 posts
  • Joined 24-September 07
  • OS:none specified
  • Country: Country Flag

Thanks for the tip and the quick reply. The registry edit is working now.

Now I have a new problem

See the attached screenshot of the issue. We know that the registry tweak worked because it directed to the PrintDir.bat file and actually managed to open notepad as instructed. So, I believe my issue now lies in the instruction block of the PrintDir.bat file. Below I have put in the code of the file, and would like to know if you know a way to tweak this the proper way...

@echo off
dir %1 /-p /o:gn > “%temp%\Listing”
start /w notepad /p “%temp%\Listing”
del “%temp%\Listing”
exit

Some suggestions ...

(0) Personally I prefer a hardcoded path for the temp folder because the global %temp% variable can easily get changed either by accident or malware.

(1) Likewise with temp filenames, I also prefer filename.ext rather than just filename to avoid a possible directory name collision. But that's just me.

(2) For absolute precision I prefer %1\*.* instead of just %1 because I don't trust the shell ( context menu ) to supply the trailing backslash. Indeed I just checked on WinXP and it does not supply the backslash. So if a file exists that matches the name of the directory you are right-clicking there will be a collision and instead of getting a directory listing you will get the name and size of the file. Also note, as jumper mentioned, there is the possibility of spaces in the folder name. But in the example registry string I gave you above, it is already handled by the escaped string ... @="\"C:\\Windows\\Printdir.bat\" \"%1\""

(3) I don't think you need the colon ":" in the DIR command sort switch. Try using just ... /ogn

(4) You are using the reverse prefix "-" on the /p pause ( did you instead want it to be on the /o sort order? ) And I am confused why it should be paused when it is intended to be printed. Or, perhaps you have DIRCMD defaults and this is intended to reverse that and prevent pausing?

(5) You are using a temp file and then deleting it, thus you need the START /w which makes sense, but the whole process is unnecessary. Since you are using the overwrite redirection operator ">" ( rather than the append ">>" ), the file is essentially deleted anyway. Scrap that concept and forget the temp file even exists and just launch NotePad. When it closes you can ignore the temp file ( no need to delete it ) because it will get overwritten later. It also may prove helpful to be able to refer back to the exact file you printed if something looks awry in the printout.

(6) I wouldn't even bother with the @echo off since without it you might get some echoed debugging clues in the CMD window if you should ever wind up in a hang situation.

(7) I don't recall needing EXIT for context menu launched batch files, but I know that using CLS after a blank line is an old trick to close stubborn CMD windows. There is a linefeed after CLS also.

So I would try this one ( depending on what that /p DIR switch is all about ) ...

dir %1\*.* /ogn /-p > C:\Temp\Listing.txt
notepad.exe /p C:\Temp\Listing.txt

cls


EDIT: almost forgot, you may want to add /a to list all files ( including hidden ) ...

dir %1\*.* /a /ogn /-p > C:\Temp\Listing.txt

Also, I always try to limit the failure vectors and specify exact filenames ( e.g., notepad.exe rather than just notepad ) to rule out malware cases like notepad.bat. Probably the best thing is to hardcode to C:\Windows\Notepad.exe to be completely safe!

Edited by CharlotteTheHarlot, 13 March 2013 - 07:20 AM.

... Let him who hath understanding reckon the Number Of The Beast ...


#11
kbdavis

kbdavis

    Newbie

  • Member
  • 10 posts
  • Joined 25-February 13
  • OS:Windows 7 x64
  • Country: Country Flag
It works perfect. Thanks for the help and the speedy replies!

#12
CharlotteTheHarlot

CharlotteTheHarlot

    MSFN Master

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,054 posts
  • Joined 24-September 07
  • OS:none specified
  • Country: Country Flag

It works perfect. Thanks for the help and the speedy replies!

Glad you have it sorted out. You should consider posting it here in its final form for others that might want to use PrintDir from the context menu. Perhaps you can also test it on a Hidden and System folder as well.

P.S. You might want to carefully audit your registry for other instances of double backslashes. If they exist they can stop other programs from working. I just started a separate thread about such things over here.

... Let him who hath understanding reckon the Number Of The Beast ...


#13
kbdavis

kbdavis

    Newbie

  • Member
  • 10 posts
  • Joined 25-February 13
  • OS:Windows 7 x64
  • Country: Country Flag
Ok here is the final product instructions, thanks to the help of CharlotteTheHarlot & Jumper for their contributions:

Open up notepad, copy and paste this code:
REGEDIT4

[-HKEY_CLASSES_ROOT\Directory\Shell\Print]
[HKEY_CLASSES_ROOT\Directory\Shell\Print]
@="&Print Directory"
[HKEY_CLASSES_ROOT\Directory\Shell\Print\Command]
@="\"C:\\Windows\\Printdir.bat\" \"%1\""
Name it anything as long as you change the extension from .txt to .reg

Open the reg file you just created and apply the changes to the registry.

Next

In a new notepad, copy and paste this code:
dir %1\*.* /a /ogn /-p > C:\Temp\Listing.txt
C:\Windows\notepad.exe /p C:\Temp\Listing.txt

cls

Save this file as PrintDir.bat. This needs to be saved in your windows directory.

Afterwards, I would restart your computer, mainly because I don't trust anything to get loaded in the memory (hence, the new registry change you just did). You can also try killing the explorer.exe process then starting it again.

Again, the credit for this goes to CharlotteTheHarlot & jumper. I am just here to condense all the suggestions they gave to make this happen. Thanks again for the help, and hope this thread helps others who are needing to print a directory.

#14
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • Joined 02-August 03
  • OS:none specified
  • Country: Country Flag
Does anyone know the Reg Key for the file Command Context Menu for files

I added this for folders and it works, thank you for the information on how to do it.
Attached File  ContextMenu1.png   10.78KB   8 downloads

I have the DeleteIt to work from the SendTo Folder but would like it on the context menu underneath the create shortcut
Attached File  ContextMenu2.png   30.35KB   9 downloads


Is it possible to have the icon appear with the Delete It on the context menu, like the Microsoft Security Essentials


GunSmokingMan



#15
CharlotteTheHarlot

CharlotteTheHarlot

    MSFN Master

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,054 posts
  • Joined 24-September 07
  • OS:none specified
  • Country: Country Flag
Since you mentioned displaying an icon I think you might be referring to "the other kind" of context menu entry. The two main methods that I know are ...

Context Menu using "Shell" ...

[HKEY_LOCAL_MACHINE\Software\Classes\xxx\Shell\yyy]
[HKEY_LOCAL_MACHINE\Software\Classes\xxx\Shell\yyy\Shell]
[HKEY_LOCAL_MACHINE\Software\Classes\xxx\Shell\yyy\Shell\Open]
[HKEY_LOCAL_MACHINE\Software\Classes\xxx\Shell\yyy\Shell\Open\Command]
@="Drive:\\Directory\\Filename.exe < parameters >"
<--- requires careful escaping of parameters and quotes

Context Menu using "ShellEx" ...

[HKEY_LOCAL_MACHINE\Software\Classes\xxx\ShellEx\ContextMenuHandlers\yyy]
@="zzz"
<--- usually a {CLSID}, this is a direct pointer to another registry key ...

[HKEY_LOCAL_MACHINE\Software\Classes\CLSID\zzz]
@="Some Description"
[HKEY_LOCAL_MACHINE\Software\Classes\CLSID\zzz\InProcServer32]
@="Drive:\\Directory\\Filename.dll"
"ThreadingModel"="Apartment"


xxx is a well-known shell object. This list is from the link mentioned below, but might not be complete ...
* ...................... All files
AllFileSystemObjects ... All files and file folders
Folder ................. All folders
Directory .............. File folders
Directory\Background ... File folder background
Drive .................. All drives in MyComputer, such as "C:\"
Network ................ Entire network (under My Network Places)
Network\Type\# ......... All objects of type #
NetShare ............... All network shares
NetServer .............. All network servers
network_provider_name .. All objects provided by network provider "network_provider_name"
Printers ............... All printers
AudioCD ................ Audio CD in CD drive
DVD .................... DVD drive (Windows 2000)


yyy of course is merely an arbitrary label sometimes ( :lol: ) used to help determine what this handler does.

The "Shell" method is a really simple way from the GUI to pass the target ( the object right-clicked ) to an external program with some rudimentary ability to define some parameters for the external program and then launch it. I think of it as roughly equivalent to a batch file. This method does not allow icons to appear.

The "ShellEx" method is complicated in that a handler DLL needs to exist. By using a canned set of code in a DLL they can offer many more procedures at runtime, including displaying of icons and sub-flyout menus, etc. Note that ShellEx itself has a variety of methods of interacting with the shell, "ContextMenuHandlers" is only one of them. There are others like "DragDropHandlers" or "PropertySheetHandlers". I don't have complete list at the moment.

From what you say it sounds like you have a Shell handler. So it will not be able to have an icon. However if this program "Delete It" includes a context menu DLL, it very well may have an icon embedded and merely needs to be registered.

Creating Shell Extension Handlers (Windows) ( MSDN )

P.S. I can't find it but there is a thread in the Win9x forum that explores a particular 3rd party ShellEx launched DLL that allows someone to define icons and a variety of other features in the context menu. Some of these things I mention above I also mentioned in that thread..

Edited by CharlotteTheHarlot, 18 March 2013 - 10:41 AM.

... Let him who hath understanding reckon the Number Of The Beast ...


#16
CharlotteTheHarlot

CharlotteTheHarlot

    MSFN Master

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,054 posts
  • Joined 24-September 07
  • OS:none specified
  • Country: Country Flag
After a little research I have figured out that the program I was trying to recall was/is called Fast Explorer by Alex Yakovlev and Serge Kolesnikov.

It was hosted at http://thesoftpro.tr...ds/fe/index.htm but appears to have vanished.

I located a page in Wayback here ... http://web.archive.org/web/20100125014241/http://thesoftpro.tripod.com/downloads/fe/index.htm

The last dated page seems to be 2008-08-24 but I have all the files and pages saved from their website as of 2010-01-26. Not sure when they went offline though. Screencap of the top of the first page ...

Posted Image

If you want to see the middle and bottom of that page open these images: part-2, part-3 ( it was too large for a single bitmap ).


P.S. I still cannot find the MSFN thread where we had discussed it.

EDIT: typo

Edited by CharlotteTheHarlot, 18 March 2013 - 02:56 PM.

... Let him who hath understanding reckon the Number Of The Beast ...


#17
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • Joined 02-August 03
  • OS:none specified
  • Country: Country Flag
Thank you for all the information
Here is a link for Fast Explorer for those that want to try it.


GunSmokingMan



#18
CharlotteTheHarlot

CharlotteTheHarlot

    MSFN Master

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,054 posts
  • Joined 24-September 07
  • OS:none specified
  • Country: Country Flag
Just wanted to mention a short reference I found, by Raymond Chen on his blog ...

What is the difference between the Folder and Directory (and other special) progids? ( 2007-08-02 )

When you're installing your shell extension, you need to know which progid to hang it off of inside HKEY_CLASSES_ROOT. We'll start with the title question and then move on to other predefined (but perhaps not well-known) progids.

  • "Folder" is the progid for any shell folder. It could be a virtual folder (like Control Panel) or a file system folder (like C:\WINDOWS).
  • "Directory" is the progid for file system folders. This is a subset of "Folder".
  • "*" is the progid for all files. Doesn't matter what the extension is.
  • "." (that's a single period) is the progid for files without any extension.
  • "AllFileSystemObjects" is the union of "*" and "Directory". It is the progid for all files and for file system directories.


The statement: "Directory" is a subset of "Folder" seems to verify something I suggested earlier in this thread about slight differences in what handlers show up when right-clicking either of those two types. I just need to confirm the details of HIDDEN and/or SYSTEM folders being excluded from "Directory".

... Let him who hath understanding reckon the Number Of The Beast ...


#19
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • Joined 02-August 03
  • OS:none specified
  • Country: Country Flag
I was able to add Delete It to the context menu where Open and Edit are located.
Thank you , I used * Reg key to add Delete it :thumbup
Attached File  DeleteItContextMenuadded.png   3.37KB   1 downloads

How To Add
1:\ Copy Application to Windows or Windows\Systen32, I used the Window folder
2:\ Open Reg Edit Expand HKEY_CLASSES_ROOT\*
3:\ Add a Key inside the Registry Shell Folder , this is also the name on the context menu Example Delete It
4:\ Create a key in inside of step 3 called command and fill in the Default with Example C:\Windows\DeleteIt.exe "%1"

Reg Key Delete It Added
Attached File  RegKeyDeleteIt.png   8.38KB   4 downloads


GunSmokingMan



#20
fdv

fdv

    MSFN Expert

  • Developer
  • 1,111 posts
  • Joined 16-July 04
  • OS:Windows 7 x64
  • Country: Country Flag
Anyone interested in INF format? You can mount the WIM and apply this and have 7 "remember" the settings I suppose.
The line for directory contents is this:
HKCR,"Folder\Shell\List Contents to text file\command",,,"%11%\cmd.exe /C DIR ""%1"" /B /O /S>""%1""""_contents list.txt"""

It makes a printable file. My INF below adds a few useful items I use all the time in 7 like using the contig utility for defragging and remember those instructions all over the 'net to make a "god mode" icon on the desktop? That's in here too but I call it 'expanded control panel' (you'll see what I mean). Edit it as you will....


[version]
Signature="$Windows NT$"

[DefaultInstall]
AddReg = ContextMenu

[ContextMenu]

; Add "command-prompt-here" functionality when right-clicking a directory
HKCR,"Drive\Shell\Command Prompt Here\command",,,"%11%\cmd.exe /k cd ""%1""" 
HKCR,"Directory\Shell\Command Prompt Here\command",,,"%11%\cmd.exe /k cd ""%1"""

;
HKCR,"*\shell\runas",,,"Take Ownership"
HKCR,"*\shell\runas","NoWorkingDirectory",,""
HKCR,"*\shell\runas\command",,,"cmd.exe /c takeown /f ""%1"" && icacls ""%1"" /grant administrators:F"
HKCR,"*\shell\runas\command","IsolatedCommand",,"cmd.exe /c takeown /f ""%1"" && icacls ""%1"" /grant administrators:F"
HKCR,"Directory\shell\runas",,,"Take Ownership"
HKCR,"Directory\shell\runas","NoWorkingDirectory",,""
HKCR,"Directory\shell\runas\command",,,"cmd.exe /c takeown /f ""%1"" /r /d y && icacls ""%1"" /grant administrators:F /t"
HKCR,"Directory\shell\runas\command","IsolatedCommand",,"cmd.exe /c takeown /f ""%1"" /r /d y && icacls ""%1"" /grant administrators:F /t"

; add advanced system properties to mycomp
HKCR,"CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\AdvSysProp",,0x00020000,"Advanced System Properties"
HKCR,"CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\AdvSysProp\command",,0x00020000,"control sysdm.cpl"

; add device manager to mycomp
HKCR,"CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Devices",,0x00020000,"Device Manager"
HKCR,"CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Devices","SuppressionPolicy",0x00010001,3c,00,00,40
HKCR,"CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Devices\command",,0x00020000,"%windir%\system32\mmc.exe /s %SystemRoot%\system32\devmgmt.msc /s"

; add the mega-control panel on mycomp
HKCR,"CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\ExpCPL",,0x00020000,"Expanded Control Panel"
HKCR,"CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\ExpCPL\command",,0x00020000,"%windir%\explorer.exe shell:::{ED7BA470-8E54-465E-825C-99712043E01C}"
; unused alternate for the exact same thing
;HKLM,"SOFTWARE\Classes\CLSID\{20d04fe0-3aea-1069-a2d8-08002b30309d}\shell\Expanded Control Panel\command",,,"%windir%\explorer.exe shell:::{ED7BA470-8E54-465E-825C-99712043E01C}"

HKCR,"Folder\Shell\List Contents to text file\command",,,"%11%\cmd.exe /C DIR ""%1"" /B /O /S>""%1""""_contents list.txt"""

; contig
HKCU,"Software\Sysinternals\C","EulaAccepted",0x00010001,01,00,00,00
HKCR,"Directory\shell\contig","",0x00020000,"Defrag Folder with Contig"
HKCR,"Directory\shell\contig\command","",0x00020000,"%windir%\system32\contig.exe ""%L\*.*"" -v -s"



#21
odar

odar

    Newbie

  • Member
  • 11 posts
  • Joined 02-April 12
  • OS:Windows 8 x64
  • Country: Country Flag
to add command to context menu in cascade (whit sub menu) for windows 7 and windows 8 from reg file

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Folder\shell\my index]
"MUIVerb"="my index name"
"SubCommands"="my prog 1;my prog 2;|;comprimi in 7z"
"icon"="C:\\Program Files\\my prog\\prog.exe, 0"
"Position"=-

[HKEY_CLASSES_ROOT\*\shell\my index]
"MUIVerb"="my index name"
"SubCommands"="my prog 1;my prog 2;|;comprimi in 7z"
"icon"="C:\\Program Files\\my prog\\prog.exe, 0"
"Position"=-
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\my prog 1]
@=my prog 1"
"icon"="imageres.dll,109"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\my prog 1\command]
@="\"C:\\Program Files\\my prog\\prog.bat\" \"%1\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\my prog 2]
@="my prog 2"
"icon"="imageres.dll,109"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\my prog 2\command]
@="\"C:\\Program Files\\my prog 2\\my prog 2.exe\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\comprimi in 7z]
@="comprimi in 7z"
"Icon"="C:\\Progra~1\\7-Zip\\7zG.exe, 0"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\comprimi in 7z\command]
@="\"C:\\Progra~1\\7-Zip\\7zg.exe\" a -t7z -mx=9 \"%1\".7z -oa \"%1\\*\""

;======================================
in context menu add 3 voice in cascade my index>(prog 1 prog2 comprimi in 7z) to max 20 voice in cascade menu
[HKEY_CLASSES_ROOT\Folder\shell\my index]============ all folder
[HKEY_CLASSES_ROOT\*\shell\my index]=============== all files
[HKEY_CLASSES_ROOT\DesktopBackground\Shell\my prog] === desktop
to wont use separator in voice use |
"SubCommands"="my prog 1;|;my prog 2;|;comprimi in 7z"
no separator in voice d'ont use |
"SubCommands"="my prog 1;my prog 2;comprimi in 7z"
position menu in context menu use botton top and midle
"Position"="Bottom"
"Position"="Top"
"Position"=-

Edited by odar, 17 May 2013 - 01:57 AM.


#22
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,534 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

Similar previous topic from 2005!

#23
exit15

exit15
  • Member
  • 4 posts
  • Joined 22-July 14
  • OS:Windows 7 x64
  • Country: Country Flag

I stumbled upon this post after trying to follow the instructions on Microsoft Support site - http://support.microsoft.com/kb/321379. The context menu was added upon running the reg file and I could even see the directory content in a notepad document for 2 seconds before it disappeared like a snapchat.

 

The alternate bat file code offered here by CharlotteTheHarlot worked well. Thanks much!

 

If someone can improve and save the txt file inside the same directory we are printing with this bat file, it will save future ‘where was this file saved to’ and it will not cause any problems of overwriting the same file when trying to print the content of multiple directories.

 

exit15



#24
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,394 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

If someone can improve and save the txt file inside the same directory we are printing with this bat file, it will save future ‘where was this file saved to’ and it will not cause any problems of overwriting the same file when trying to print the content of multiple directories.

You mean this one?



dir %1\*.* /ogn /-p > C:\Temp\Listing.txt
notepad.exe /p C:\Temp\Listing.txt
cls

Try with:



@ECHO OFF
DIR %1\*.* /ogn /-p > %1\Listing.txt 
notepad.exe /p %1\Listing.txt 

This should save the "Listing.txt" file to the same directory which was passed as a parameter to the batch, is this what you want? :unsure:

I would personally find more "correct" this version:



@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
DIR "%~1\*.*" /ogn /-p > "%~1\Listing.txt"
notepad.exe /p "%~1\Listing.txt"

but the result should be the same.

 

jaclaz


Edited by jaclaz, 23 July 2014 - 02:22 AM.


#25
exit15

exit15
  • Member
  • 4 posts
  • Joined 22-July 14
  • OS:Windows 7 x64
  • Country: Country Flag

This one worked like a charm -- thanks (Fixing a small typo - ECHO OFF)

 

@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
DIR "%~1\*.*" /ogn /-p > "%~1\Listing.txt"
notepad.exe /p "%~1\Listing.txt"

exit15






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN