问题
When desktop applications set to run on startup, they usually start minimized to system tray. The common approach to implement this behavior is an special parameter for the executable when adding a shortcut to the Startup folder or registry:
MyApp.exe /startminimized
I need the same thing in a converted desktop app. Thanks to the StartupTask, I'm able to run the executable of the app on startup:
<desktop:Extension
Category="windows.startupTask"
Executable="MyApp.exe"
EntryPoint="Windows.FullTrustApplication">
<desktop:StartupTask
TaskId="MyStartupTask"
Enabled="true"
DisplayName="Some Arbitrary Name" />
</desktop:Extension>
However, I'm not able to find a way to set an argument for the executable so that my app knows it is running from startup and starts minimized.
I should be able start another executable which starts my app minimized but I'm looking for a more elegant approach to directly run the app minimized and keep the startup impact low.
回答1:
There is no way to specify a parameter for startup task today unfortunately. It is an open work item on our backlog.
As you point out, a possible work around is to launch a different EXE that then launches your app in the desired mode.
Thanks!
来源:https://stackoverflow.com/questions/45835631/how-to-specify-parameters-for-the-executable-file-in-a-startuptask