Jump to content

File List (FileList.txt) Registry Tweak


miko

Recommended Posts

(I meant to mention something in this thread a while ago, and now that it has been bumped ...)

In my mind there are three ways to use the context menu registry shell keys to issue DOS commands to a folder (or files).

;

;;; Method 1 :: using Registry to issue an actual DOS command

; NOTE: you are limited to a single command line of course

;

[HKEY_LOCAL_MACHINE\Software\Classes\Folder\Shell\Generate-FileList]

@="Generate a FileList ..."

[HKEY_LOCAL_MACHINE\Software\Classes\Folder\Shell\Generate-FileList\Command]

@="CMD.EXE /C DIR \"%1\" /A:-D/B/O:GNE/-P/S>\"%%date:~-10,2%%-%%date:~-7,2%%-%%date:~-4,4%%_%%time:~0,2%%-%%time:~3,2%%-%%time:~6,2%%.txt\""

;

;;; Method 2 :: using Registry to call a shortcut (PIF or LNK) to a batch file

; NOTE: trial and error to use %1 successfully

;

[HKEY_LOCAL_MACHINE\Software\Classes\Folder\Shell\Generate-FileList]

@="Generate a FileList ..."

[HKEY_LOCAL_MACHINE\Software\Classes\Folder\Shell\Generate-FileList\Command]

@="C:\\Dos\\FileList.pif %1"

; or ...

@="C:\\Dos\\FileList.pif \"%1\""

;

;;; Method 3 :: using Registry to call a batch file directly

; NOTE: trial and error to use %1 successfully

;

[HKEY_LOCAL_MACHINE\Software\Classes\Folder\Shell\Generate-FileList]

@="Generate a FileList ..."

[HKEY_LOCAL_MACHINE\Software\Classes\Folder\Shell\Generate-FileList\Command]

@="C:\\Dos\\FileList.bat %1"

; or ...

@="C:\\Dos\\FileList.bat \"%1\""

Method-1 is already discussed at length here in this thread and really leads to some amazingly creative command lines strings due to the complex quoting and escaping of the characters. A bit complicated I think. The best thing about this method is that you only need to add the REG entry and your done. But, needless to say the limitation is of using a single command line because of the fact that the Shell COMMAND subkey is one single string.

Offloading the commands to a batch file makes the editing easier and gives the advantage of using multiple command lines. This, for example would allow you to echo extra lines for a header and external commands to get date and time and other housekeeping information to also have in the filelist. It is great to be able to echo commands to the console like Generating Filelist, please wait! and other stuff to show status and whatnot.

Method-2 is really an offshoot of the way we used to have a context menu entry for Open CMD window here ... which called a PIF or LNK shortcut (to COMMAND.COM or CMD.EXE) depending on the OS. The shortcut was hard-coded to its target, in this case a BAT file. The shortcut could accept a parameter. But shortcuts, especially PIF files are notorious for breaking later, particularly on WinXP. The biggest problem is that porting the filelist function from computer to computer involved not only the REG key and the BAT file, but also a pre-configured PIF or LNK. , so we can skip this method and go straight to ...

Method-3 is (IMHO) the best way to launch stuff from the context menu. As mentioned above there will be no limitations on how many commands can be launched from the single registry shell entry. Besides multiple echo commands for output formatting in the actual filelist and console feedback for the user, it allows testing such as for OS (e.g., Win9x could use ANSI screen colors on the console), copy the output to multiple locations, insert date and time strings into the filelist, send the filelist immediately into an editor, create a unique filename using date and time strings so that the filelist is unique, (etc ...). But the most important advantage is that FileList.bat is the only place that needs any editing ever. Once the very simple shell entry is in place, there is no need to dicker around in the registry anymore. The strange escaping and quoting needed for commands in the registry can easily lead to errors, whereas the syntax of batch commands is tried and true.

DISADVANTAGES: Porting the function involves the REG key *and* the BAT file (rather than a mere REG patch). NOTE-1: on some computers it is still necessary to set properties on the BAT file to close window when done, but not always. NOTE-2: some trial and error may be necessary to make use %1 in that REG string, but very often all that is needed is that one simple line: @="C:\\Dos\\FileList.bat %1" (with no escape). I've never been able to understand why this is inconsistent on some computers. It must be all the automated tweaking from REG patches that changes certain little aspects on every computer. :angry:

Link to comment
Share on other sites

  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...