How to specify parameters for the executable file in a StartupTask

梦想与她 提交于 2019-12-22 10:43:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!