In my software I'm using ShellExecuteEx to open a report that is presented as a local .htm file. At times on some end-user systems there's no default file association for the .htm files.
To set such file association up on a pre-Windows 10 system I'd install the following registry keys to use IE:
Key: HKEY_CURRENT_USER\Software\Classes\htm.file\Shell\open\Command
REG_SZ name: ""
REG_SZ value: "C:\Program Files (x86)\Internet Explorer\iexplore.exe" "%1"
Key: HKEY_CURRENT_USER\Software\Classes\.htm
REG_SZ name: ""
REG_SZ value: htm.file
Key: HKEY_CURRENT_USER\Software\Classes\.htm
REG_SZ name: PerceivedType
REG_SZ value: Document
Then I notify Windows Explorer of the change:
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
It works well, but how do you do the same for Microsoft Edge on Windows 10?
PS.:
I don't want to use IE there because it always shows an extra tab with the nag to switch to Edge, which is very confusing for my end-users.
On Windows 10, it is done with IApplicationAssociationRegistrationInternal ("2a848e25-d688-4aa3-8e55-0c16cb3a2dfb")
created with SHCreateAssociationRegistration
Set "AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9" for Microsoft Edge ProgId
(tested on Windows 10 - 1803, 17134.820)
Related
Is there a way i can associate a file type like (.php, .css, .js) to a custom icon, even when the file has been associate with a program.
for example on my computer .php is associated to sublime text, and when i encounter .php on my file system it show ST's icon, is there a way to make it change to a custom icon like the good ol' elephant, but still be associated with ST i.e when i click the file it still open's in ST(== sublime text).
I know how to do it for filetypes assigned to Notepad++.
In Windows 10, Notepad++ keeps hijacking the icons of filetypes that you open (by default) in Notepad++. It was very difficult to break that behaviour, but I finally got it working!
Preparations
1. Registry permissions
Open the Windos registry, and give yourself enough "permissions" for the folders HKEY_CLASSES_ROOT and HKEY_CURRENT_USER. I'm not sure myself what are the minimum settings for the whole procedure to succeed. You've got to play a bit with the settings. Anytime you get an error message in the coming procedure, go back to this step and increase your registry permissions.
2. Make some custom icons
Make some custom icons, for example in the folder C:\ICONS\. I use the following website https://iconverticons.com/online/ to convert 256x256 png-files into ico-files.
3. Install Notepad++
Just get Notepad++. Nothing special here.
4. Open a terminal with admin rights
Type cmd in the windows search bar. Right click on the CMD-icon that appears and choose "Run as administrator" in the popup window.
Registry hacking
Disclaimer: changing your registry can potentially cause damage to your Windows installation. I have written down the procedure below with best intentions, but I deny any responsibility in case something goes wrong.
Note: I DON'T recommend to use this procedure for .bat files. This is a very important file-type for Windows. So I don't know what would happen if you delete its standard registry keys.
The procedure below describes how to assign a custom icon - which you created in C:\ICONS\abcfile.ico - to all *.abc files.
1. Registry hacking, part one
The first registry key you should add is HKEY_CLASSES_ROOT\.abc. In case this key already exists, you might want to delete it. Use the following command to delete the key and all its subkeys:
> REG DELETE HKEY_CLASSES_ROOT\.abc /f
The following figure shows how we will (re)build this registry key and all its subkeys:
You can do it manually or run the following commands:
> REG ADD HKEY_CLASSES_ROOT\.abc /ve /t REG_SZ /d "abc_auto_file"
> REG ADD HKEY_CLASSES_ROOT\.abc /v BrowserFlags /t REG_DWORD /d 0x00000000
> REG ADD HKEY_CLASSES_ROOT\.abc /v EditFlags /t REG_DWORD /d 0x00000000
> REG ADD HKEY_CLASSES_ROOT\.abc /v PerceivedType /t REG_SZ /d "text"
> REG ADD HKEY_CLASSES_ROOT\.abc\DefaultIcon /ve /t REG_SZ /d "C:\ICONS\abcfile.ico,0"
2. Registry hacking, part two
The second registry key you should add is HKEY_CLASSES_ROOT\abc_auto_file. In case this key already exists, you might want to delete it. Use the following command to delete the key and all its subkeys:
> REG DELETE HKEY_CLASSES_ROOT\abc_auto_file /f
The following figure shows how we will (re)build this registry key and all its subkeys:
You can do it manually or run the following commands:
> REG ADD HKEY_CLASSES_ROOT\abc_auto_file /ve /t REG_SZ
> REG ADD HKEY_CLASSES_ROOT\abc_auto_file\DefaultIcon /ve /t REG_SZ /d "C:\ICONS\abcfile.ico"
> REG ADD HKEY_CLASSES_ROOT\abc_auto_file\shell /ve /t REG_SZ
> REG ADD HKEY_CLASSES_ROOT\abc_auto_file\shell\edit /ve /t REG_SZ
> REG ADD HKEY_CLASSES_ROOT\abc_auto_file\shell\edit\command /ve /t
> REG_EXPAND_SZ /d "\"C:\Program Files (x86)\Notepad++\notepad++.exe\" \"^%1\""
> REG ADD HKEY_CLASSES_ROOT\abc_auto_file\shell\open /ve /t REG_SZ
> REG ADD HKEY_CLASSES_ROOT\abc_auto_file\shell\open\command /ve /t
> REG_EXPAND_SZ /d "\"C:\Program Files (x86)\Notepad++\notepad++.exe\" \"^%1\""
3. Registry hacking, part three
The second registry key you should add is HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.abc. In case this key already exists, you might want to delete it. Use the following command to delete the key and all its subkeys:
> REG DELETE HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.abc /f
The following figure shows how we will (re)build this registry key and all its subkeys:
You can do it manually or run the following commands:
> REG ADD HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.abc /ve /t REG_SZ
> REG ADD HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.abc\OpenWithList /ve /t REG_SZ
> REG ADD HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.abc\OpenWithProgids /ve /t REG_SZ
> REG ADD HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.abc\OpenWithProgids /v "C:\Program Files (x86)\Notepad++\notepad++.exe" /t REG_NONE /d 0
> REG ADD HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.abc\OpenWithProgids /v abc_auto_file /t REG_NONE /d 0
Refresh icon cache
The following command should refresh the Windows icon cache:
> %windir%\system32\ie4uinit.exe -show
Assign Notepad++ to the filetype
I've noticed that - sometimes - the changes only take effect after assigning Notepad++ as the default program to open the filetype.
This is how to do that:
Create a file with the given filetype, eg: myFile.abc
Right click on the file, and select "open with" >> "another app"
You should get a popup window like:
Select Notepad++ as the default program
Finish
Normally the icon has changed now! And all files of that particular filetype will have the custom icon. They will open by default in Notepad++.
Perhaps you should again refresh the icon cache:
> %windir%\system32\ie4uinit.exe -show
or restart your system to let it take effect (although restarting wasn't needed for me).
How do I automatically launch a non-Surface application in Windows Embedded 8?
I want to automatically launch a GUI application on startup in Windows Embedded 8, but I can't figure out how to do it. I've been reading Sean Liming's Professional's Guide to Windows Embedded 8 Standard, and in chapter 8 he describes how to modify the device experience. He names how there is a Windows 8 Application launcher, but for Surface apps only. He also describes a Shell Launcher module, but my app is not a shell. He also mentions a shell he wrote here, but reading through its documentation, it doesn't describe how to automatically launch a program within that shell.
As far as I can tell, he doesn't describe how to automatically launch a non-Surface application anywhere, and Google and Stack Exchange get me no results (it doesn't help that most results come back as merely Windows 8, and not Windows Embedded 8). Or am I mistaken? Is Shell Launcher sufficient to launch a non-shell app? Does the app launched become the "shell", in effect?
Side note: It's probably worth mentioning that the app I want to launch is a Java app. I will be including the module-based Java JRE installer as mentioned in the book, but if there are any other provisos to launching a Java app in WE8S, please comment.
Thanks for your time and feedback!
This works for both Windows Embedded Standard 7 and Windows Embedded 8 Standard:
I normally install Windows Embedded Standard with the standard shell. In WE8S this would be the Metro UI. Once installation and configuration is complete, and your application runs successfully, I use registry entries to modify the application launched on startup.
Custom user-specific shell
As an example, to launch VLC media player as the shell, and play media files in a folder on the d:\ e.g d:\media in a continuous loop, I use the below in a .bat file, running as administrator.
This must be run while logged into the user that will launch the custom shell
Create a new .bat file:
in Windows Explorer, Select "File" -> "New" -> "Text Document"
Rename "New Text Document.txt" to custom_shell.bat
Paste the below into the file
Save the file
Right click the file -> "Run as Administrator"
c:\Windows\system32\reg.exe DELETE "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /f
c:\Windows\system32\reg.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d explorer.exe
c:\Windows\system32\reg.exe ADD "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "c:\program files\vlc\vlc.exe -f --loop ""d:\media"""
c:\Windows\system32\reg.exe DELETE "HKLM\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot" /v Shell /f
c:\Windows\system32\reg.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot" /v Shell /t REG_SZ /d "USR:Software\Microsoft\Windows NT\CurrentVersion\Winlogon"
pause
This modifies the shell for the !Current User! (i.e. the logged on user) to launch VLC.exe on logon. (I use reg.exe because some slimmed down installations might not have regedit.exe included)
This means that you can still access the full user interface when logging on as the administrator user (via safe mode if Administrator profile is normally disabled), since the shell for all other users is still the explorer shell.
Launching the explorer shell from within the custom shell
You can still launch the explorer shell with the metro UI when the user with the custom shell is logged on. To launch the explorer shell from the user running the VLC (custom) shell:
Start the task manager (CTRL+SHIFT+ESC)
Click on the "Advanced" button at the bottom of the task manager
Select "File" -> "New Task (Run...)" from the menu bar
Enter "Explorer.exe" (This start the explorer service)
Repeat the above steps again (This will lauch an instance of Windows Explorer)
The Metro UI should be usable then
Java application as a shell
More to the point, in order to run your java app, change the below entry in the above .bat
from:
c:\Windows\system32\reg.exe ADD "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "c:\program files\vlc\vlc.exe -f --loop ""d:\media"""
to
c:\Windows\system32\reg.exe ADD "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "java [any other JVM options you need to give it] -jar "path\jar-file-name.jar""
If your java app does not include a manifest the above will not work!
Try this (I have not tested this):
java -cp jar-file-name.jar full.package.name.ClassName
Revert to the Explorer (default shell) i.e. Undo user-specific shell
To undo the shell changes for the user i.e. revert back to original settings:
!This must be run while logged into the user with the custom shell!
Create a new .bat file:
in Windows Explorer, Select "File" -> "New" -> "Text Document"
Rename "New Text Document.txt" to default_shell.bat
Paste the below into the file
Save the file
Right click the file -> "Run as Administrator"
c:\Windows\system32\reg.exe DELETE "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /f
c:\Windows\system32\reg.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d explorer.exe
c:\Windows\system32\reg.exe DELETE "HKLM\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot" /v Shell /f
c:\Windows\system32\reg.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot" /v Shell /t REG_SZ /d "SYS:Microsoft\Windows NT\CurrentVersion\Winlogon"
c:\Windows\system32\reg.exe DELETE "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /f
pause
User Auto Logon:
You can configure Windows to automatically log onto a specific user profile.
Start > Search > netplwiz
OR [Windows Key + R] > netplwiz
A ‘User Account’ window will open. Highlight the account you want to automatically load when Windows starts.
Uncheck the box above it titled “Users must enter a user name and password to use this computer.”
Click OK.
You will be prompted to confirm the operation by entering your password.
Enter your password to complete the change.
The next time you start up Windows, the user account you selected will automatically be loaded
Things to consider
Play around, but use a test environment if possible
If you can launch the shell, so can someone else. Use the keyboard filter to filter out known key combinations, and create one only you, and perhaps the service technicians will know.
Remove admin rights for the user with the custom shell
Use the Unified Write Filter (or Enhanced Wright Filter/File Based Write Filter). Un-protect only when making changes.
A big THANK YOU to Sean Liming and the work that does - he inspired this.
Mark Böhmer
Windows Embedded Specialist
South Africa
Is there a way to set Sublime Text as the default text editor for file formats on Windows 7?
Also, if anyone knew a Sublime Text Tutorial or Wiki that would be really helpful.
Actually it is not my answer, I have just googled it:
Open regedit (Win+R, type "regedit", select OK).
Navigate to HKEY_CLASSES_ROOT\Applications\sublime_text.exe\shell\open\command
Verify that the path is accurate, correct it if it is not. Exit regedit.
Open task manager via Ctrl+Alt+Del (or Ctrl+Shift+Esc for later versions of Windows), kill explorer.exe, go to run (Win+R) and type "explorer.exe" (or skip this step and simply reboot).
Now attempt the same thing, right click a text file, open with, navigate to sublime, and it should now appear in the list of available applications.
For me that value pointed to the Desktop where portable version previously was placed. Thus it just didn't work.
P.S. And for me the reboot or logout were not necessary (WinXP).
Edit on Nov 21, 2014
Tim Lewis pointed out in the comment that there is a more generic version at http://www.binaryfortress.com/NotepadReplacer/, which works better.
Original Answer
Try this: https://github.com/grumpydev/Sublime-Notepad-Replacement
Here are some ways to associate Sublime Text Portable. The following text needs to be saved as a file with a .reg extension and then on that file Right Click > Merge.
This will add a Sublime right click menu entry to all files:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell]
#="Sublime"
[HKEY_CLASSES_ROOT\*\shell\Sublime]
#="&Sublime"
[HKEY_CLASSES_ROOT\*\shell\Sublime\command]
#="\"D:\\PortableApps\\SublimeText\\sublime_text.exe\" \"%1\""
This will have Sublime Text replace all calls to notepad.exe:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\Notepad.exe]
"Debugger"="\"D:\\PortableApps\\SublimeText\\sublime_text.exe\" -z"
This will create a SublimeFile class which you can then associate with any extension.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\SublimeFile\shell]
#="edit"
[HKEY_CLASSES_ROOT\SublimeFile\DefaultIcon]
#="\"D:\\PortableApps\\SublimeText\\sublime_text.exe\",0"
[HKEY_CLASSES_ROOT\SublimeFile\shell\edit\command]
#="\"D:\\PortableApps\\SublimeText\\sublime_text.exe\" \"%1\""
This will then associate the .ext extension with SublimeFile:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.ext]
#="SublimeFile"
1: You can also set your associations in Control Panel:
Control Panel > Default Programs > Associate a file or protocol with a specific program:
2: Or, call it from code via IApplicationAssociationRegistrationUI::LaunchAdvancedAssociationUI ;)
HRESULT LaunchAdvancedAssociationUI(
[in] LPCWSTR pszAppRegName
);
You can just run CCleaner's registry cleaner tool and then choose and add the default program as usual. It worked for me when upgrading from ST2 to ST3.
Open context menu on file with desired extension in Explorer, than select Open with->You editor ( may be you need to browse for its binary before it appears in the list of available programs ) and set checkbox "Always use the selected program to open this kind of file".
I tried all options to make sublime text 3 as the default program for my .php, .css and/or .js files
I don't exactly know why it all failed, I think it is related to windows 10 current version bug
But the good news is there is some working way for me, also for those who love CMD
open CMD as administrator
run this line: FTYPE sublime="C:\Program Files\Sublime Text 3\sublime_text.exe" "%1"
for .php files use this command: ASSOC .php=sublime for js use this: ASSOC .js=sublime and so on...
Try this,
#echo off
SET st2Path=C:\Program Files\Sublime Text 2\sublime_text.exe
rem add it for all file types
#reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
#reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
#reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
rem add it for folders
#reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
#reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
#reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
pause
I tested this for SublimeText 3(Portable) also and working fine. Create a .bat file with the above code and run it as administrator.
Reference : https://gist.github.com/mrchief/5628677
sublime can be set as the default text editor by following these steps:
right-click on the .txt file and select properties.
then in Open with: option click on Change.
if the sublime is listed in the list of apps then select it, if not scroll down and click on the look for another app on this PC and select the sublime app file
I was facing the same problem.
the only solution was correct it manually
--> open regedit and navigate to Computer\HKEY_CLASSES_ROOT\Applications\, find the sublime_text.exe entry, and delete it. You should now be able to set Sublime Text 3 as the default editor for anything you want.
i found this solution in this post:https://forum.sublimetext.com/t/cant-make-default-editor-in-windows/10747/14
If you are using the portable version, you can't set Sublime as the default program for any files because Windows won't acknowledge it as a program that can open things.
Is the best way to look under the Uninstall key of the Windows Registry?
Is there a Microsoft API call which provides this info and is it supported from XP onwards?
What is the best way to detect which version of Internet Explorer is installed on the local machine?
You have to look in the registry, but not in uninstall key. Instead,
find the key at HKLM\Software\Microsoft\Internet Explorer and read the value named Version.
For newer versions (IE 10 and above), Version is 9.x (for example, IE 10 is 9.10.something), and the new svcVersion value gives the true IE version.
This technique is even recommended by Microsoft; see here.
If you require to know the IE version into a web application you can get the User-Agent or use javascript:
You got here a Microsoft sample of how to get the internet Explorer version
http://msdn.microsoft.com/en-us/library/ms537509(VS.85).aspx
If you require to detect the IE Version into a Desktop program with X language you need to read the Windows registry
This registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer contains the attribute Version with the IE version
The Version value doesn't seem to include the Internet Explorer version information that you would most likely need. Instead, look at either svcVersion or svcUpdateVersion for the information.
As an example, I am running IE 10 and if I query the Version registry value 9.10.9200.16798 is returned but if I query svcUpdateVersion 10.0.13 is returned. The latter corresponds to the actual Internet Explorer version which is 10.
REG QUERY "HKLM\Software\Microsoft\Internet Explorer" /v Version
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer
Version REG_SZ 9.10.9200.16798
REG QUERY "HKLM\Software\Microsoft\Internet Explorer" /v svcUpdateVersion
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer
svcUpdateVersion REG_SZ 10.0.13
REG QUERY "HKLM\Software\Microsoft\Internet Explorer" /v svcVersion
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer
svcVersion REG_SZ 10.0.9200.16798
I'd like to challenge the conventional wisdom of inspecting the registry. Consider the reference source for System.Windows.Forms.WebView.Version:
string mshtmlPath =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "mshtml.dll");
FileVersionInfofvi = FileVersionInfo.GetVersionInfo(mshtmlPath);
return new Version(
fvi.FileMajorPart, fvi.FileMinorPart, fvi.FileBuildPart, fvi.FilePrivatePart);
Presumably, the guys who wrote the WebView class knew what they were doing.
You can also know the IE version on multiple computers using this script:
#Echo off
Cls
MD C:\SYSADMIT > NUL
Echo. > c:\SYSADMIT\Resultados.txt
SET ListaEquipos=C:\SYSADMIT\ListaEquipos.txt
For /F "Tokens=*" %%z In (%ListaEquipos%) Do (
echo %%z >> c:\SYSADMIT\Resultados.txt
reg query "\\%%z\hklm\Software\Microsoft\Internet Explorer" /v svcVersion >> c:\SYSADMIT\Resultados.txt
)
Inside the file: ListaEquipos.txt, there is a list of computers.
It is also necessary to check RemoteRegistry service enabled on the target computers.
Extracted from: http://www.sysadmit.com/2017/08/windows-buscar-version-de-internet-explorer-en-equipo-remoto.html
I'm deploying a small conversion tool on some systems, and want the users to be able to run it from the right click Open with menu. But I don't want to change the default program users have associated to this file type.
It is easy to associate a file extension/type to a program, but how to do it (programatically of course) without changing the default program?
Setting the following keys worked for me:
key HKLM/SOFTWARE/Microsoft/Windows/CurrentVersion/App Paths/<progname>: "" = <appPath>
key HKCR/Applications/<progname>/SupportedTypes: <fileExt> = ""
key HKCR/<fileExt>: "" = <progID>
key HKCR/<progID>/OpenWithList/<progName>
key HKCR/<fileExt>/OpenWithList/<progName>
key HKCR/SystemFileAssociations/<fileExt>/OpenWithList/<progName>
delete key and subkey at HKCU/SOFTWARE/Microsoft/Windows/CurrentVersion/Explorer/fileExts/<fileExt>
You can add scripts to the context menu (below Open with) by adding it in the windows registry:
Open regedit
Goto HKEY_CLASSES_ROOT\your_class\Shell
Add a new key and give it a name
Edit the (Default) value of this key and insert the text you want to show in the context menu
Add a new key named Command under your newly created key
Edit the (Default) value of this key and insert the command you want to execute
Enjoy!
In the "File Types" Windows Dialog you can click "Advanced" on your file type and there create a custom action tied to your application.
Possibly you can also find a way to do this in a programmatic manner, or at least create a .REG file with the equivalent registry options.
I have achieved the correct FILE ASSOCIATION using these cmd commands.
(just an example):
REG ADD "HKEY_CLASSES_ROOT\Applications\notepad++.exe\shell\open\command" /v # /t REG_SZ /d "\"C:\\Program Files\\Noteepad++\\notepad++.exe\" \"%1\"" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt" /v "Application" /t REG_SZ /d "notepad++.exe" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\OpenWithList" /v "g" /t REG_SZ /d "notepad++.exe" /f
assoc .txt=MyCustomType
ftype MyCustomType="C:\Program Files\Noteepad++\notepad++.exe" "%1"
(it's better to put them in .bat file)
here's a worked example for XP adding a command prompt option to folders. Create a .reg file
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\Command Prompt]
[HKEY_CLASSES_ROOT\Directory\shell\Command Prompt\command]
#="cmd.exe /k cd \"%1\""