Author Topic: Starting the Windows Store App mit Command Line Parameters  (Read 1226 times)

multicart

  • Junior Member
  • **
  • Posts: 49
    • View Profile
Starting the Windows Store App mit Command Line Parameters
« on: November 25, 2024, 09:36:10 »
Hi Mathias,

I have the Windows Store App version of MC. Company policy.
Now, I want to start it with CLPs. I asked MS Copilot.
I do find the installation path in the UWP_Apps_List.txt created with the PowerShell command Get-AppxPackage.
I saw that there is a seemingly normal MultiCommander.exe.
When I start it with CLPs, everything seems to work fine as expected.
However, MS Copilot warned me against starting that exe directly, since it supposedly could have undesired side-effects, since a Windows Store App is not supposed to be started with an exe directly.

So, I thought, I ask the dev directly. What do you recommend?

Many thx, regards, m.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4451
    • View Profile
    • Multi Commander
Re: Starting the Windows Store App mit Command Line Parameters
« Reply #1 on: November 25, 2024, 10:29:01 »
Actually I'm not sure how the Windows Store App work.. MC is a full thrust .exe store app. But it does sandbox some folders (System and system registry, so MC store edition cannot modify them)
Since MC is a full .exe app and not a UWP app I think you can start the exe, But i'm not 100% sure.

There should be way to start them from command line using the app package names.. But I'n not sure exactly how that works.

multicart

  • Junior Member
  • **
  • Posts: 49
    • View Profile
Re: Starting the Windows Store App mit Command Line Parameters
« Reply #2 on: November 27, 2024, 09:37:45 »
For all MC users:

ok, I now managed to do it this way:

1) A PowerShell script that starts the MC App with command line parameters:
Code: [Select]
# Despite the -WindowStyle Hidden parameter, the PowerShell window still pops up briefly.
# Therefore, I am starting this script with a separate vb script.
# For some reason, with the vb script, I can avoid any window to pop other than MC itself, which was not possible with the PS script.

$appPackage = "48089MathiasSvensson.MultiCommander_9d7x1c4ybj2dr!MultiCommander"
$arguments = "-AutoRun=_UDC_runAt_MC_Startup"
Start-Process -FilePath "shell:AppsFolder\$appPackage" -ArgumentList $arguments -WindowStyle Hidden
Hint: I had previously tried to start the MC App with a shortcut using eplorer.exe (something like "explorer.exe shell:AppsFolder\[MC app folder]![AppId] [parameter]") but in this way it would not work to hand over any command line parameters. It would start the app without parameters, but as soon as I added them it would not even start anymore. I tried all kinds of variants with the quotes, but the only solution that I finally found was to use the PS script.

2) A VB script that starts the PS script in order to prevent the PS window from popping up:
Code: [Select]
' MsgBox "Just for testing: VB script started", 0, "VB script started"
Set objShell = CreateObject("WScript.Shell")
objShell.Run "powershell.exe -NoProfile -ExecutionPolicy Bypass -File ""[name of powershell script].ps1""", 0, False

3) A shortcut to the VB script in order to be able to pin it to the task bar:
Target:
Code: [Select]
C:\Windows\System32\wscript.exe "[path and name of VB script].vbs"Hint: I found out the hard way, that for some reason it is possible that the task bar does not like shortcuts with defined working directories that deviate from the path in the target definition.

So, the PowerShell does the heavy lifting. If you are ok, without the option to start it from the taskbar and are ok with the PowerShell window to pop up briefly, then you only need the ps1 script.

And regarding the taskbar, unfortunately there is a drawback, that can not be changed AFAIK. Since the shortcuts points to wscript.exe, it will be a separate item on the taskbar and the actual MC item will pop up or exist next to it, ending up in the shortcut item that starts MC and then MC (when its running) on its own with a separate item. Not really pretty, but I found no solution. So far, I personally rather have the starting shortcut in the taskbar, and live with the fact that the running MC item is next to it, than not having the starting shortcut in the taskbar.

regards, m.
« Last Edit: November 27, 2024, 09:49:52 by multicart »

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4451
    • View Profile
    • Multi Commander
Re: Starting the Windows Store App mit Command Line Parameters
« Reply #3 on: November 27, 2024, 10:08:40 »
Nice. special "shell:" tag for the Windows App was needed.

However it did not work using .bat script? Powershell it way over powered for just starting something.

Startmc.bat
Code: [Select]
start shell:AppsFolder\48089MathiasSvensson.MultiCommander_9d7x1c4ybj2dr!MultiCommander -AutoRun=_UDC_runAt_MC_Startup
It will show a console window very briefly. But if you create a Lnk shortcut for it
startmc_shortcut.lnk

And in properties for it. Set it to start minimized. Then the command window is not shown while it starts MC store edition



multicart

  • Junior Member
  • **
  • Posts: 49
    • View Profile
Re: Starting the Windows Store App mit Command Line Parameters
« Reply #4 on: November 29, 2024, 09:51:17 »
Thank you, that works almost as good.

If you want to pin the shortcut to the taskbar, the target in the shortcut could be:
cmd.exe /c "[path to startmc.bat]\startmc.bat"
« Last Edit: November 29, 2024, 10:08:44 by multicart »