Use application registration besides shimming.
- Dominant language
- C#
- Stars
- 11.5k
- Forks
- 960
- PR merge metrics
- No merged PRs in 30d
Description
This is a general problem with many packages - they don't provide easy access that is typical in Linux world. Shimming solves only part of it in an IMO not a good way: more then I would like I have weird situations around shimmed apps.
That is one of the reasons I created [`Register-Application`](https://github.com/chocolatey/chocolatey-coreteampackages/blob/master/extensions/chocolatey-core.extension/extensions/Register-Application.ps1) so that GUI apps are available both in WIN + R, windows start menu search and PowerShell console with profile script [`Set-AppKeyAliases.ps1`](https://github.com/majkinetor/posh/blob/master/MM_Admin/Set-AppKeyAliases.ps1).
[Application Registration](https://msdn.microsoft.com/en-us/library/windows/desktop/ee872121(v=vs.85).aspx) is an offical way provided by MS instead of PATH due to its limitations (see [`Repair-Path`](https://github.com/majkinetor/posh/blob/master/MM_Admin/Repair-Path.ps1) for details on those). I generally use PATH if there are more then few apps (sysinternals, nirlauncher etc.) and shim for 1 or 2 apps in a package.
Appliation Registration **can completelly replace shims** with few simple tricks.
Currently with above mentioned PowerShell profile script registered apps work in Posh:
```powershell
PS> Set-AppKeyAliases -Verbose
VERBOSE: 7zFM = C:\Program Files\7-Zip\7zFM.exe
VERBOSE: Ahk2Exe = C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe
VERBOSE: AutoHotkey = C:\Program Files\AutoHotkey\AutoHotkey.exe
VERBOSE: Blend = C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Blend.exe
VERBOSE: chrome = C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
VERBOSE: clementine = C:\Program Files (x86)\Clementine\clementine.exe
WARNING: Ignoring invalid path for 'cmmgr32' : ''
VERBOSE: ConEmu64 = C:\Program Files\ConEmu\ConEmu64.exe
VERBOSE: devenv = C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe
WARNING: Ignoring invalid path for 'dfshim.dll' : ''
VERBOSE: dnGREP = C:\Program Files\dnGREP\dnGREP.exe
VERBOSE: excel = C:\PROGRA~1\MICROS~1\Office16\EXCEL.EXE
VERBOSE: firefox = C:\Program Files\Mozilla Firefox\firefox.exe
VERBOSE: foxitreader = C:\Program Files (x86)\Foxit Software\Foxit Reader\FoxitReader.exe
WARNING: Ignoring invalid path for 'fsquirt' : ''
VERBOSE: IEDIAG = C:\Program Files\Internet Explorer\IEDIAGCMD.EXE
VERBOSE: IEDIAGCMD = C:\Program Files\Internet Explorer\IEDIAGCMD.EXE
VERBOSE: IEXPLORE = C:\Program Files\Internet Explorer\IEXPLORE.EXE
WARNING: Ignoring invalid path for 'install' : ''
VERBOSE: licensemanagershellext = C:\Windows\System32\licensemanagershellext.exe
WARNING: Ignoring invalid path for 'LogiLDA.dll' : ''
VERBOSE: mfbclient = C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\mfbclient.exe
VERBOSE: mip = C:\Program Files\Common Files\Microsoft Shared\Ink\mip.exe
VERBOSE: mplayer2 = C:\Program Files (x86)\Windows Media Player\wmplayer.exe
VERBOSE: MSACCESS = C:\PROGRA~1\MICROS~1\Office16\MSACCESS.EXE
WARNING: Ignoring invalid path for 'MsoHtmEd' : ''
VERBOSE: msoxmled = C:\Program Files\Common Files\Microsoft Shared\OFFICE16\MSOXMLED.EXE
VERBOSE: mtm = C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\mtm.exe
VERBOSE: nirlauncher = C:\tools\NirLauncher\nirlauncher.exe
VERBOSE: notepad++ = C:\Program Files\Notepad++\notepad++.exe
VERBOSE: ntp = C:\Windows\notepad.exe
VERBOSE: pbrush = C:\Windows\System32\mspaint.exe
VERBOSE: powerpnt = C:\PROGRA~1\MICROS~1\Office16\POWERPNT.EXE
VERBOSE: PowerShell = C:\Windows\system32\WindowsPowerShell\v1.0\PowerShell.exe
WARNING: Ignoring invalid path for 'setup' : ''
VERBOSE: smplayer = C:\Program Files\SMPlayer\smplayer.exe
VERBOSE: SnippingTool = C:\Windows\system32\SnippingTool.exe
VERBOSE: srptool = c:\Program Files\Git\mingw64\bin\srptool.exe
WARNING: Ignoring invalid path for 'table30' : ''
VERBOSE: TabTip = C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe
VERBOSE: tixati = C:\Program Files\tixati\tixati.exe
VERBOSE: vbox = C:\Program Files\Oracle\VirtualBox\virtualbox.exe
VERBOSE: virtualbox = C:\Program Files\Oracle\VirtualBox\virtualbox.exe
WARNING: Ignoring invalid path for 'vstoee.dll' : ''
VERBOSE: wab = C:\Program Files\Windows Mail\wab.exe
VERBOSE: wabmig = C:\Program Files\Windows Mail\wabmig.exe
VERBOSE: WinMerge = C:\Program Files (x86)\WinMerge\WinMergeU.exe
VERBOSE: WinMergeU = C:\Program Files (x86)\WinMerge\WinMergeU.exe
VERBOSE: Winword = C:\PROGRA~1\MICROS~1\Office16\WINWORD.EXE
VERBOSE: wmplayer = C:\Program Files (x86)\Windows Media Player\wmplayer.exe
VERBOSE: WORDPAD = C:\Program Files\Windows NT\Accessories\WORDPAD.EXE
VERBOSE: WRITE = C:\Program Files\Windows NT\Accessories\WORDPAD.EXE
WARNING: Alias not writable: WRITE
```
To have the same effect in cmd.exe (which is finally [not default shell anymore](http://www.theregister.co.uk/2016/11/18/windows_cmdexe_deposed_by_powershell/)) one can use `doskey`, a la:
doskey srptool="c:\Program Files\Git\mingw64\bin\srptool.exe"
**If chocolatey profile contains the said script and chocolatey installer adds [cmd.exe startup script](http://stackoverflow.com/a/17405182/82660) in registry that does the doskey stuff, we will cover all 3 worlds - powershell, cmd and Explorer. Furthermore, both mechanisms can exist at the same time so package maintainer can choose. Furthermore at least 50% of apps actually register application during installation so there is actually nothing to be done half of the time, it just works with profile scripts set.**
Management of this stuff is also easier - even ccleaner and friends would remove invalid enteries while leftover shims will be deleted by no tool. You also can't know if shim actually shims correct application until you check it out personally in detail.
On linux the sistuation is the same - almost all apps, GUI or CLI register in console. Unified experience on multiple platforms is great feature.
I think this is valuable. Implementing such a change is trivial. Stuff is already implemented. Action plan would be
- Add `Set-AppKeyAliases` in chocolatey profile.
- Add cmd.exe registry stuff [not implemented].
- [optional] Move `Register-Application` to choco helpers.
cc @AdmiringWorm @gep13
Contributor guide
Research direction
Start by reviewing the linked Register-Application.ps1, Set-AppKeyAliases.ps1, and Repair-Path.ps1 scripts, then inspect the chocolatey profile and installer entry points for the proposed PowerShell and cmd.exe startup integration. Done means registered applications are discoverable from PowerShell, cmd.exe, and Explorer without relying solely on shims.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- cli, operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100