WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: fhammer on March 03, 2016, 11:35:18 AM

Title: associations for new file type
Post by: fhammer on March 03, 2016, 11:35:18 AM
I've written a general-purpose .wbt utility which reads a text file, specified as a command-line parameter (accessed as param1). For example "my_utility.wbt  infile.txt". What I would like to do is this:

Name my input files with a particular (unused) extension (e.g. infile.src instead of infile.txt) and set up a file association so that, whenever I double-click an input file (with the extension .src), it will be passed to my utility.

It seems like there should be a straight-forward way to do this in Windows, but I haven't found it yet.

(I think it may be related to the fact that my_utility.wbt is not an exe file, but must in-turn be passed to the winbatch processor.)
Title: Re: associations for new file type
Post by: td on March 03, 2016, 01:53:02 PM
Assuming you have FileMenu installed, the answer to your question is already on your system.  Look at the menu item "Associate              ;Associate this type of file with an application" in your 'FileMenu for ALL filetypes.mnw' file under the WinBatch System directory.   You can make WinBatch.exe the executable with your script being the first parameter and "%%1" the second parameter.

There are also examples in the Tech Database.  Here is a link to one:

http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/How~To+Associate~Extension~to~Run~Winbatch~File.txt (http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/How~To+Associate~Extension~to~Run~Winbatch~File.txt)
Title: Re: associations for new file type
Post by: fhammer on March 03, 2016, 03:27:26 PM
Thanks for the quick response. I'm having trouble getting started with FileMenu. I've viewed the link you provided and the FileMenu section in the WinBatch User's Guide. It says FileMenu should have been installed when I installed WinBatch. However, I'm not seeing the expected context menu choices when I right-click on a file in Windows Explorer.

I do see the filemenu dll in the winbatch directory. I vaguely remember seeing some of the context menu choices in the past. I think "Clipboard Tricks" used to appear.

I have and old version of Winbatch, but prefer not to upgrade or re-install just yet. I'm probably just missing something obvious.

Thanks again for your help.
Title: Re: associations for new file type
Post by: td on March 03, 2016, 05:35:05 PM
It all depends on what you mean by 'old' and which version of Windows you have it installed on.   If you have a 64-bit system  Windows 7 or newer and your version of WinBatch predates 64-bit WinBatch then your are mostly out of luck.  However, you don't need to use FileMenu to look at the file I mentioned.