I had a similar requirement. I finally wrote a Python script that creates a Windows registry file that sets the type as I desired. Use at your own risk.
#
SLICKEDIT_ROOT = r'C:\\Program Files\\SlickEdit Pro 21.0.3'
def Vsreg_header_write(fp):
fp.write('Windows Registry Editor Version 5.00\n')
def Vsreg_key_write(fp, s):
fp.write('\n')
fp.write('[' + s + ']\n')
#
#[HKEY_CLASSES_ROOT\Applications\vs.exe]
#
#[HKEY_CLASSES_ROOT\Applications\vs.exe\shell]
#
#[HKEY_CLASSES_ROOT\Applications\vs.exe\shell\open]
#
#[HKEY_CLASSES_ROOT\Applications\vs.exe\shell\open\command]
#@="\"C:\\Program Files\\SlickEdit Pro 21.0.3\\win\\vs.exe\" \"%1\""
def Vsreg_app_register(fp):
root = r'HKEY_CLASSES_ROOT\Applications\vs.exe'
Vsreg_key_write(fp, root)
Vsreg_key_write(fp, root + r'\shell')
Vsreg_key_write(fp, root + r'\shell\Edit')
fp.write(r'@="&Edit"' + '\n')
Vsreg_key_write(fp, root + r'\shell\Edit\command')
fp.write(r'@="\"' + SLICKEDIT_ROOT + r'\\win\\vs.exe\" \"%1\""' + '\n')
Vsreg_key_write(fp, root + r'\shell\open')
Vsreg_key_write(fp, root + r'\shell\open\command')
fp.write(r'@="\"' + SLICKEDIT_ROOT + r'\\win\\vs.exe\" \"%1\""' + '\n')
#
#[HKEY_CLASSES_ROOT\.c]
#@="SlickEdit.c"
#"Content Type"="text/plain"
#"PerceivedType"="text"
#
#[HKEY_CLASSES_ROOT\SlickEdit.c]
#@="c file (SlickEdit)"
#
#[HKEY_CLASSES_ROOT\SlickEdit.c\DefaultIcon]
#@="C:\\Program Files\\SlickEdit Pro 21.0.3\\bitmaps\\bbfile_association.ico"
#
#[HKEY_CLASSES_ROOT\SlickEdit.c\shell]
#
#[HKEY_CLASSES_ROOT\SlickEdit.c\shell\open]
#"FriendlyAppName"="SlickEdit"
#
#[HKEY_CLASSES_ROOT\SlickEdit.c\shell\open\command]
#@="\"C:\\Program Files\\SlickEdit Pro 21.0.3\\win\\vs.exe\" \"%1\""
#
#[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.c]
#@="c file"
#
#[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.c\OpenWithList]
#"a"="vs.exe"
#"b"="NOTEPAD.EXE"
#"MRUList"="ab"
#
#[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.c\OpenWithProgids]
#"SlickEdit"=hex(0):
#"txtfile"=hex(0):
#
#[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.c\UserChoice]
#"Progid"="SlickEdit.c"
def Vsreg_ext_process(fp, ext):
# HKEY_CLASSES_ROOT\.c
root = 'HKEY_CLASSES_ROOT\\.%s' % ext
Vsreg_key_write(fp, root)
fp.write('@="SlickEdit.%s"\n' % ext )
fp.write('"Content Type"="text/plain"\n')
fp.write('"PerceivedType"="text"\n' )
# HKEY_CLASSES_ROOT\SlickEdit.c
root = 'HKEY_CLASSES_ROOT\\SlickEdit.%s' % ext
Vsreg_key_write(fp, root)
fp.write('@="%s File (SlickEdit)"' % ext.upper() + '\n')
Vsreg_key_write(fp, root + r'\DefaultIcon')
fp.write(r'@="' + SLICKEDIT_ROOT + r'\\bitmaps\\bbfile_association.ico"' + '\n')
Vsreg_key_write(fp, root + r'\shell')
Vsreg_key_write(fp, root + r'\shell\open')
fp.write('"FriendlyAppName"="SlickEdit"\n')
Vsreg_key_write(fp, root + r'\shell\open\command')
fp.write(r'@="\"' + SLICKEDIT_ROOT + r'\\win\\vs.exe\" \"%1\""' + '\n')
# HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.c
root = r'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.%s' % ext
Vsreg_key_write(fp, root)
fp.write(r'@="%s file"' % ext + '\n')
Vsreg_key_write(fp, root + r'\OpenWithList')
fp.write(r'"a"="vs.exe"' + '\n')
fp.write(r'"b"="NOTEPAD.EXE"' + '\n')
fp.write(r'"MRUList"="ab"' + '\n')
Vsreg_key_write(fp, root + r'\OpenWithProgids')
fp.write(r'"SlickEdit"=-' + '\n')
fp.write(r'"SlickEdit.%s"=hex(0):' % ext + '\n')
fp.write(r'"txtfile"=hex(0):' + '\n')
Vsreg_key_write(fp, root + r'\UserChoice')
fp.write(r'"Progid"="SlickEdit.%s"' % ext + '\n')
fp = open('vs.reg', 'wt')
Vsreg_header_write(fp)
Vsreg_app_register(fp)
l= 'arm c cfg cpp e gnu h hpp log mak txt'.split()
print l
for ext in l:
Vsreg_ext_process(fp, ext)
fp.close()