I need to know if my wpf application is started from startup folder or by clicking on desktop link to exe file. How can I do this?
Your application does not know where it is called from, only where it is executing (working folder). IMHO your best option is to pass a parameter when launching from a desktop shortcut.
If your installer is adding the shortcut to the startup folder, you could include a command line argument (only for the startup shortcut). You could then check for this argument.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.