eMI FileNameExtension-ProgramAssociation Module
Developer: | eMedia Intellect |
---|---|
Initial release: | |
Stable release: | 1.0.0.7 () |
Written in: | PowerShell (UTF-8) |
Operating system: | Microsoft Windows |
Size: | 15298 bytes |
Development status: | Completed |
Available in: | English |
Type: | Configuration module |
Licence: | GNU GPLv3 |
Download: | github.com powershellgallery.com root.emi.is |
eMI FileNameExtension-ProgramAssociation Module is a PowerShell module to associate file name extensions with programs. This is accomplished by modifying the Windows Registry. Windows 8 introduced a more complex implementation of file association. This solution may therefore not work at all times with all file name extensions, particularly if the user has previously performed file association using the Windows shell.
Overview
- eMI.FileNameExtensionProgramAssociation directory
- AssociateFilesWithProgram.psm1 file
- eMI.FileNameExtensionProgramAssociation.psd1 file
- gpl-3.0.txt file
The module consists of a single function called AssociateFilesWithProgram
. It takes the following 3 mandatory arguments:
-FileNameExtensions
(string array)- Specifies the file name extensions to associate with a program. An array item containing a full stop (
'.'
) represents extensionless files. -FileTypeName
(string)- Specifies the file type name of the file name extensions. In the Windows Registry, the file name extensions point to a file type name which in turn points to a program. This argument must not contain any white-space.
-ProgramPath
(string)- Specifies the path to the program to which the file type name points.
Usage
In the following example, two program associations are created, each containing 3 extensions:
# Import the module into the current session.
Import-Module -Name 'eMI.FileNameExtensionProgramAssociation'
# Extensionless files, text files and XML files are associated with Visual Studio Code.
AssociateFilesWithProgram -FileNameExtensions @('.', '.txt', '.xml') -FileTypeName 'Visual-Studio-Code' -ProgramPath 'C:\Program Files\Microsoft VS Code\Code.exe'
# Ogg files are associated with VLC media player.
AssociateFilesWithProgram -FileNameExtensions @('.oga', '.ogg', '.ogv') -FileTypeName 'VLC-media-player' -ProgramPath 'C:\Program Files (x86)\VideoLAN\VLC\vlc.exe'
Authorship
Stefán Örvar Sigmundsson, programmer
Licence
eMI FileNameExtension-ProgramAssociation Module by eMedia Intellect is licensed under GNU General Public License version 3.