ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

auto create .lnk shortcuts for all currently installed Windows Store Apps

<< < (2/3) > >>

4wd:
Changed it a little w.r.t. what's regarded as an App.

4wd:
This Python solution works for me without running as administrator https://stackoverflow.com/a/43635956
I had to use Python 2. The .lnk shortcut files also get icons (issue 3 above).
Perhaps the approach there can be reproduced without Python.-Nod5 (April 01, 2019, 10:18 AM)
--- End quote ---

Just as a matter of interest, what is the shortcut Target that is generated by the above script?

Does it use explorer.exe shell:.... or does it resolve to the executable?

ie. It would be easy to add an icon to the shortcut but you'd need to resolve to the executable to fetch it.

Nod5:
what is the shortcut Target that is generated by the above script?
Does it use explorer.exe shell:.... or does it resolve to the executable?
-4wd (April 04, 2019, 06:25 AM)
--- End quote ---
It isn't an ordinary .lnk shortcut file. The target field is greyed out in the file properties window. This is for Calculator app:



The target field contains only Microsoft.WindowsCalculator_8wekyb3d8bbwe!App, so the Explorer.exe shell:Appsfolder\ part from the regular shortcuts isn't there.

When I open the .lnk in HxD Hex Editor it decodes to among other things this path string
C:\Program Files\WindowsApps\Microsoft.WindowsCalculator_10.1902.42.0_x64__8wekyb3d8bbwe
which is a protected folder that contains these files

--- ---AppxBlockMap.xml
AppxManifest.xml
AppxSignature.p7x
Calculator.exe
CalculatorApp.winmd
resources.pri
WinMetadataand subfolders

--- ---AppxMetadata
Assets
The .lnk file also contains strings that are paths to .png icons files in the Assets subfolder above.

I'm not familiar enough with the Windows API and python stuff in the StackOverflow code to understand what it is doing line by line.

4wd:
I thought it might be looking at the PNG images in the Assets folder, I can get the path and executable via PowerShell but none of the executables contain an icon according to Windows.

Trouble is working out which PNG to use since due to standards the names aren't standard.

The PowerShell commands to get all the info pertaining to Apps are:
Get-AppxPackage
Get-AppxPackageManifest

Also, the manifest for some apps, (eg. Photos & Video Editor) is the same since the only difference is the entry point into the app which you can see in the shortcuts my script above created:

Photos:        C:\Windows\explorer.exe shell:Appsfolder\Microsoft.Windows.Photos_8wekyb3d8bbwe!App
Video Editor: C:\Windows\explorer.exe shell:Appsfolder\Microsoft.Windows.Photos_8wekyb3d8bbwe!SecondaryEntry

Below is a small script that gets the App name, ID, path, executable, and logo:

--- Code: PowerShell ---cls$apps = (Get-StartApps)#$apps | Get-Member$j = 0for ($i = 0; $i -lt $apps.Count; $i++) {  if (($apps[$i].AppID).Contains("!")) {    $j++    Write-Host "Name: $($apps[$i].Name)"    Write-Host "  AppID: $($apps[$i].AppID)"    $package = Get-AppxPackage -Name ($apps[$i].AppID).SubString(0, ($apps[$i].AppID).IndexOf("_"))#    if ($package.SignatureKind -eq "Store") {#      $package | Get-Member      Write-Host "  InstallLocation: $($package.InstallLocation)"      $manifests = Get-AppxPackageManifest -Package $package      foreach ($manifest in $manifests) {        foreach($app in $manifest.Package.Applications.Application) {#          $app | Get-Member#          Write-Host "  Id: $($app.Id)"          Write-Host "  Executable: $($app.Executable)"          Write-Host "  Logo: $($manifest.Package.Properties.Logo)"        }      }#    }  }}Write-Host $j
The remarked lines are just me experimenting with trying to narrow down the list.

Output
--- Code: Text ---Name: GetThemAll - Video Downlaoder  AppID: NimbusWeb.GetThemAll-VideoDownlaoder_p5fjnfwkc9ns0!App  InstallLocation: C:\Program Files\WindowsApps\NimbusWeb.GetThemAll-VideoDownlaoder_2.3.2.0_x64__p5fjnfwkc9ns0  Executable: NativeMessagingFFMPEG.exe  Logo: Assets\StoreLogo.pngName: Microsoft Edge  AppID: Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge  InstallLocation: C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe  Executable: MicrosoftEdge.exe  Logo: Assets\MicrosoftEdgeSquare50x50.png  Executable: MicrosoftEdgeCP.exe  Logo: Assets\MicrosoftEdgeSquare50x50.png  Executable: MicrosoftEdgeCP.exe  Logo: Assets\MicrosoftEdgeSquare50x50.png  Executable: MicrosoftEdgeCP.exe  Logo: Assets\MicrosoftEdgeSquare50x50.png  Executable: MicrosoftPdfReader.exe  Logo: Assets\MicrosoftEdgeSquare50x50.pngName: Connect  AppID: Microsoft.PPIProjection_cw5n1h2txyewy!Microsoft.PPIProjection  InstallLocation: C:\Windows\SystemApps\Microsoft.PPIProjection_cw5n1h2txyewy  Executable: Receiver.exe  Logo: Assets\StoreLogo.pngName: Cortana  AppID: Microsoft.Windows.Cortana_cw5n1h2txyewy!CortanaUI  InstallLocation: C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy  Executable: SearchUI.exe  Logo: Assets\Icons\MediumTile.png  Executable: RemindersShareTargetApp.exe  Logo: Assets\Icons\MediumTile.png  Executable: Cain.exe  Logo: Assets\Icons\MediumTile.pngName: Mixed Reality Portal  AppID: Microsoft.Windows.HolographicFirstRun_cw5n1h2txyewy!App  InstallLocation: C:\Windows\SystemApps\Microsoft.Windows.HolographicFirstRun_cw5n1h2txyewy  Executable: MixedRealityPortal.exe  Logo: Assets\MixedRealityPortalMedTile.pngName: Windows Defender Security Centre  AppID: Microsoft.Windows.SecHealthUI_cw5n1h2txyewy!SecHealthUI  InstallLocation: C:\Windows\SystemApps\Microsoft.Windows.SecHealthUI_cw5n1h2txyewy  Executable: SecHealthUI.exe  Logo: Assets\DefenderAppSplashScreen.scale-400.pngName: Settings  AppID: windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel  InstallLocation: C:\Windows\ImmersiveControlPanel  Executable: SystemSettings.exe  Logo: images\logo.pngName: Print 3D  AppID: Microsoft.Print3D_8wekyb3d8bbwe!App  InstallLocation: C:\Program Files\WindowsApps\Microsoft.Print3D_3.1.2612.0_x64__8wekyb3d8bbwe  Executable: Print3D.exe  Logo: Assets\manifestAssets\StoreLogo.pngName: Get Help  AppID: Microsoft.GetHelp_8wekyb3d8bbwe!App  InstallLocation: C:\Program Files\WindowsApps\Microsoft.GetHelp_10.1706.12921.0_x64__8wekyb3d8bbwe  Executable: GetHelp.exe  Logo: Assets\Logo.pngName: Maps  AppID: Microsoft.WindowsMaps_8wekyb3d8bbwe!App  InstallLocation: C:\Program Files\WindowsApps\Microsoft.WindowsMaps_5.1812.10071.0_x64__8wekyb3d8bbwe  Executable: Maps.exe  Logo: Assets\AppTiles\MapsStoreLogo.pngName: Messaging  AppID: Microsoft.Messaging_8wekyb3d8bbwe!x27e26f40ye031y48a6yb130yd1f20388991ax  InstallLocation: C:\Program Files\WindowsApps\Microsoft.Messaging_4.1901.10241.0_x64__8wekyb3d8bbwe  Executable: MessagingApplication.exe  Logo: Assets\StoreLogo.pngName: Calculator  AppID: Microsoft.WindowsCalculator_8wekyb3d8bbwe!App  InstallLocation: C:\Program Files\WindowsApps\Microsoft.WindowsCalculator_10.1812.10048.0_x64__8wekyb3d8bbwe  Executable: Calculator.exe  Logo: Assets\CalculatorStoreLogo.pngName: 3D Viewer  AppID: Microsoft.Microsoft3DViewer_8wekyb3d8bbwe!Microsoft.Microsoft3DViewer  InstallLocation: C:\Program Files\WindowsApps\Microsoft.Microsoft3DViewer_6.1903.4012.0_x64__8wekyb3d8bbwe  Executable: 3DViewer.exe  Logo: Assets\StoreLogo.pngName: OneNote  AppID: Microsoft.Office.OneNote_8wekyb3d8bbwe!microsoft.onenoteim  InstallLocation: C:\Program Files\WindowsApps\Microsoft.Office.OneNote_16001.11425.20094.0_x64__8wekyb3d8bbwe  Executable: onenoteim.exe  Logo: images\OneNoteAppList.pngName: Aussie TV FTW!  AppID: 55758OcelotSoft.AussieTVFTW_jzcqt2s08q53y!App  InstallLocation: C:\Program Files\WindowsApps\55758OcelotSoft.AussieTVFTW_1.8.0.0_x64__jzcqt2s08q53y  Executable: AussieTV.exe  Logo: Assets\StoreLogo.pngName: Alarms & Clock  AppID: Microsoft.WindowsAlarms_8wekyb3d8bbwe!App  InstallLocation: C:\Program Files\WindowsApps\Microsoft.WindowsAlarms_10.1902.633.0_x64__8wekyb3d8bbwe  Executable: Time.exe  Logo: Assets\AlarmsStoreLogo.pngName: Paint 3D  AppID: Microsoft.MSPaint_8wekyb3d8bbwe!Microsoft.MSPaint  InstallLocation: C:\Program Files\WindowsApps\Microsoft.MSPaint_5.1811.20017.0_x64__8wekyb3d8bbwe  Executable: PaintStudio.View.exe  Logo: Assets\Logos\StoreLogo\PaintApplist.pngName: OverDrive - Library eBooks & Audiobooks  AppID: 2FA138F6.OverDriveMediaConsole_daecb9042jmvt!App  InstallLocation: C:\Program Files\WindowsApps\2FA138F6.OverDriveMediaConsole_3.8.0.5_neutral__daecb9042jmvt  Executable: MediaConsole.Win8.exe  Logo: Assets\StoreLogo.pngName: Voice Recorder  AppID: Microsoft.WindowsSoundRecorder_8wekyb3d8bbwe!App  InstallLocation: C:\Program Files\WindowsApps\Microsoft.WindowsSoundRecorder_10.1902.633.0_x64__8wekyb3d8bbwe  Executable: SoundRec.exe  Logo: Assets\VoiceRecorderStoreLogo.pngName: Microsoft Store  AppID: Microsoft.WindowsStore_8wekyb3d8bbwe!App  InstallLocation: C:\Program Files\WindowsApps\Microsoft.WindowsStore_11811.1001.27.0_x64__8wekyb3d8bbwe  Executable: WinStore.App.exe  Logo: Assets\AppTiles\StoreLogo.pngName: Photos  AppID: Microsoft.Windows.Photos_8wekyb3d8bbwe!App  InstallLocation: C:\Program Files\WindowsApps\Microsoft.Windows.Photos_2019.19021.18010.0_x64__8wekyb3d8bbwe  Executable: Microsoft.Photos.exe  Logo: Assets\PhotosStoreLogo.png  Executable: VideoProjectsLauncher.exe  Logo: Assets\PhotosStoreLogo.pngName: Video editor  AppID: Microsoft.Windows.Photos_8wekyb3d8bbwe!SecondaryEntry  InstallLocation: C:\Program Files\WindowsApps\Microsoft.Windows.Photos_2019.19021.18010.0_x64__8wekyb3d8bbwe  Executable: Microsoft.Photos.exe  Logo: Assets\PhotosStoreLogo.png  Executable: VideoProjectsLauncher.exe  Logo: Assets\PhotosStoreLogo.pngName: Camera  AppID: Microsoft.WindowsCamera_8wekyb3d8bbwe!App  InstallLocation: C:\Program Files\WindowsApps\Microsoft.WindowsCamera_2019.124.60.0_x64__8wekyb3d8bbwe  Executable: WindowsCamera.exe  Logo: Assets\WindowsIcons\StoreLogo.png23

I can try and find some correlation regarding the image they use from the Assets folder since some folders don't contain images with the same name as other Assets folders - there maybe be something in the manifest I can work from.

EDIT: Think I found where the image is specified in the manifest - can you upload a couple or so of the icons the Python script created?

Nod5:
Thanks for continuing this detective work  :)

The Python script doesn't create any icon image files per se. In the hex editor the .lnk contains these relative path strings

--- ---Assets\CalculatorMedTile.png
Assets\CalculatorAppList.png
Assets\CalculatorWideTile.png
Assets\CalculatorLargeTile.png
Assets\CalculatorSmallTile.png
The matching Assets folder has for each of the above multiple .png files with the same start name then a dot and some size/color specification. For example

--- ---CalculatorAppList.contrast-black_scale-200.png
CalculatorAppList.contrast-black_targetsize-16.png
CalculatorAppList.contrast-black_targetsize-20.png
...
It looks like one or other of the .png that start with CalculatorAppList is used for the icon for the .lnk when I view it in Explorer.

But the .png in Assets are black and white while the .lnk icon is white with blue background. (But maybe the blue is dependent on some Windows theme?)

I examined a few more of the python generated .lnk in the hex editor but can't see any simple consistent pattern in the name of the .png filenames.

Anyway, recreating the look and feel of the icons in the python generated shortcuts involves both finding the right .png to use and transforming its color.

I attach one of the .png files and an overview screenshot from Explorer with many of the image files.

Shortcut files are more complicated that one might have though :o
https://github.com/libyal/liblnk/blob/master/documentation/Windows%20Shortcut%20File%20(LNK)%20format.asciidoc

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version