Get Windows to treat files with the same extension differently
Solution 1:
Windows does not launch files based on any information in the file - building a database for that would take an incredible amount of work and programming. The only true way to identify a file is by the binary signatures in the file, if the file even has it, and this is up to the software author to implement.
In Windows, files are passed to the program you specify for a particular file extension. Windows determines a file's extension as the substring which follows the last occurrence of a period, so it's not possible with the file names you posted.
You have to either re-name the files (and give them unique file extensions), or write a batch file to launch the appropriate application for you. For more details, see this Technet article.
Solution 2:
I solved it myself:
I made a Python script that reads the first few bytes of a file and compares them to a dictionary, then launches the appropriate program based on the magic numbers.
import sys
import subprocess
magic_numbers = {
'OB': r'C:\Program Files (x86)\DesignSoft\Tina 9 - TI\TINA.EXE', # TINA
'*v': r'C:\Program Files (x86)\Orcad\Capture\Capture.exe', #PSpice
'DP': r'C:\Program Files (x86)\Design Explorer 99 SE\Client99SE.exe', #Protel
'\x00\xFE': r'C:\MentorGraphics\9.0PADS\SDD_HOME\Programs\powerlogic.exe', #PADS Logic
'\x10\x80': r'C:\Program Files (x86)\EAGLE-5.11.0\bin\eagle.exe', # Eagle
}
filename = sys.argv[1]
f = open(filename, 'rb')
# Read just enough bytes to match the keys
magic_n = f.read(max(map(len, magic_numbers)))
subprocess.call([magic_numbers[magic_n], filename])
Latest version will be here: Launch ambiguous files in the appropriate program
I tried to associate the file extension with this script, but Windows 7 didn't let me. It just associated it with Python instead, so I went into the registry and added the script name manually.
Room for improvement, but it works. I can double-click on different files with the same .sch extension and they open in different apps.
Update: I've converted it to an .exe using cx_freeze, with an external YAML config file, and it's easy to associate. See also this libmagic proposal. Not sure if I should make this into a full-fledged "libmagic launcher for Windows" or if it's better to handle only one file extension with one .exe and a simple YAML file.