Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a usb stick with PortableApps that I carry around between different places.

But one thing that annoys me, is when I open a file (such as *.flv or *.html), either Windows says it is unsupported or it opens a program that I do not want to use (eg Win.M.P.), while I have the "correct" program (that I want to use) on my USB drive.

Is there any portable program that can associate my "unsupported" files when I execute just one/a few program/s?

(I was about to use ftype and assoc on a batch file, but it requires administrator privileges, so that doesn't seem to be the best solution.)

share|improve this question

5 Answers 5

up vote 6 down vote accepted
+50

I use a lot of portable apps, and I use two programs especially made for this. They both do the same thing, but in different ways.

eXpresso (made using AutoHotkey) intercepts mouse clicks and changes the action to open whichever program that you associate the file type with.

Portable File Associator (made using AutoIt) makes file association entries in the HKCU registry hive, which does not need admin rights, and it can be set to remove them when the program is exited. I prefer this one, as it can also be made to make the entries and then exit without removing the associations, which is useful on my own computers (the instructions for more advanced use are in a file somewhere in the program folder). The way it works also allows you to define icons to the file types. When you download this program, the password for the archive file is in the file name.

Programs made using AutoIt and AutoHotkey can sometimes get flagged as viruses by anti-virus programs, as viruses have been made using them, but these programs are totally safe.

share|improve this answer
    
Similar programs - PEM (Portable Extension Manager), Portable Extension Warlock. –  Karan Jan 20 '13 at 3:39
    
The download link is broken. Any idea where I can find a working copy? –  Keyslinger Jan 26 '13 at 1:35

Here is what I use, which might be overcomplicated:

  • Have a batch file on the USB drive that maps its folder to the Q: or another drive letter (subst Q: "%~dp0" basically)
  • Use a portable explorer with custom file associations. I use FreeCommander; under “Extras, Preferences, Programs” you can set custom programs to open when hitting F4 on your files, depending on their extension. I have mapped 7z,zip,tar,etc. to 7zip-portable for example. So all you have to do is set the editor to Q:\7z-portable\7zportable.exe and that's all.
share|improve this answer
    
Adding +1 for good answer. But is it possible to do it in a simpler way? Or can you explain your answer in more detail of how/why map the folder to `Q:` or another drive? –  user824294 Feb 3 '12 at 11:24
2  
@user824294 I would assume this allows him to keep his associations static. They always go to Q:\myprogram.exe instead of different_every_time:\myprogram.exe –  Oliver Salzburg Feb 4 '12 at 0:17
    
@Oliver Salzburg: I couldn't say it better. –  Benoit Feb 13 '12 at 8:26

You can use the standard assoc command in a batch script (.bat) to save, set and reset file associations.

The assoc command can display and association, for example, in a Command Prompt (cmd) :

image1

The command can also set a file-association :

image2

You can create the following two .bat files on the root folder on the USB disk (or elsewhere). These batch files require the presence in the same folder of a file named prefix that you create only once using notepad and typing the string "assoc ", without the quotes and with the ending blank and (very important) without pressing Enter (so it doesn't have an end-of-line).

The first .bat file we will call myapps.bat, and whose purpose will be to assign the new file association, after creating another restore.bat file that you will use before ejecting the USB disk in order to restore the old file associations.

An example myapps.bat to set the file associations of html, abab and htm to myprog1.exe etc. :

@echo off
echo @echo off >restore.bat
cmd /q /c doassoc html "%cd%\myprog1.exe"
cmd /q /c doassoc abab "%cd%\myprog2.exe"
cmd /q /c doassoc htm "%cd%\myprog3.exe"
del ftemp1
del ftemp

The variable %cd% stands for the current directory, but you can also use %cd:~0,2% which will give you the current disk (for example G:) together with any other relative file specification on the disk.

The doassoc.bat file which does the work for one file association will contain :

echo assoc .%1= >ftemp1
assoc .%1 >nul
IF %ERRORLEVEL% NEQ 0 goto notfound
assoc .%1 >ftemp
copy /b /y prefix+ftemp ftemp1 >nul
:notfound
copy /b /y restore.bat+ftemp1 restore.bat >nul
assoc .%1=%2

An example of the result when running myapps.bat followed by restore.bat is :

image3

share|improve this answer
1  
Awesome. But could you verify that it does not require admin privileges? +50 if it does not. –  user824294 Feb 4 '12 at 2:18
    
Sorry, I was testing this with UAC disabled. assoc does require admin rights. –  harrymc Feb 5 '12 at 8:54
    
I would delete this, except that it may still be useful for somebody. Don't bother to undervote. –  harrymc Feb 5 '12 at 10:09

I assume you are using software packaged by PortableApps.com. While we are waiting for file associations to be implemented, Xenon Portable may be the easiest solution.

You can use the GUI to manage file associations...

settings

editor

or you can edit the XenonPortable\Data\settings\assoc.ini configuration file.

The format is as follows:

[<extension>]
icon=<image>.ico
exe=|XEDIR|\<path>

Where <path> is relative to the XenonPortable directory.

share|improve this answer

You could use the XYplorer portable file manager. Its latest version is commercial, but the last freeware version is still available from here.

Its Portable File Associations can associate file extensions with applications and even with user-written scripts :

image

share|improve this answer
    
Flash: XYplorer 10.80 is free today on giveawayoftheday. –  harrymc Feb 6 '12 at 9:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.