Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want files ending in .fw.png to open in Adobe Fireworks but I want regular .png files to open in my standard image viewer program.

Is this possible?

share|improve this question
To all voting to close: Initially I thought this question was an exact duplicate, but upon further review, the question being asked does differ significantly enough to warrant a new question. – Breakthrough Dec 13 '11 at 12:56
Not a dupe. Suggested question is for files with exactly the same extension; this is different. – Hello71 Dec 17 '11 at 23:40
up vote 6 down vote accepted

Using an AutoIt script, the following should perform what you want:

$FIREWORKS = "C:/Program Files/Fireworks.exe"
$NORMALVWR = "C:/WindowsPictureViewer.exe"

If $CmdLine[0] > 0 Then
    $toRun = ""
    $fExt = StringRight($CmdLine[1], 7)

    ; First, we set $toRun as the proper target program to run.
    If StringLen($CmdLine[1]) >= 7                  And _
       StringRight($fExt, 4) = ".png"               And _
       StringLeft(StringRight($fExt, 7), 3) = ".fw" Then
        $toRun = $FIREWORKS
        $toRun = $NORMALVWR 

    ; Next, we append all command line arguments (with a space before each one).
    For $i = 1 To $CmdLine[0]
        $toRun &= ' "' & $CmdLine[$i] & '"'   ; We surround each with quotation marks.

    ; Finally, run the command in the current working directory.
    Run($toRun, @WorkingDir)
    ; Since the Run() function is asynchronous, this program should close right after.

To make this work for your case, you'll need to change those constants up at the top to the proper executables you want to launch. Then, install AutoIt, and compile the script to a .EXE file. Place it in a convent location, and set Windows to open .PNG files with this executable.

I haven't tested this code yet, but it looks like it should work fine. Just for your reference, the compiled program will do the following:

  1. Check if the first argument (if it exists) ends in .fw.png (it is assumed you only run the executable with a .PNG to begin with). If so, the Fireworks executable is launched, otherwise, the normal viewer is launched.

  2. All of the command line arguments are then added again as arguments to the respective application.

  3. The application is called via the AutoIt Run() function, in the current working directory.

If enough people are interested, I can create a full program to do this for any arbitrary set of (nested) file extensions.

share|improve this answer
You have a syntax error on line 9, there's a stray close paren after "StringLen($CmdLine[1]) >= 7". Other than that it compiles and works like a charm, thanks. – Rob Jul 25 '15 at 10:25
@Rob good catch, thank you - I've updated the answer accordingly. – Breakthrough Jul 27 '15 at 1:45

Your Answer


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.