How to use a button click event in c# to activate run a desktop shortcut to open a program

删除回忆录丶 提交于 2021-02-10 05:42:14

问题


I have many shortcuts on the desktop and some work on the newer windows store apps that reside in the windowsapps folder, that cannot be run by clicking the exe file. so I want to use a button in my c#.net winforms app so when I click on it, it is the same as if I double clicked the icon on the desktop. I do not know enough about shell execute to know if that can do it. Any help would be greatly appreciated


回答1:


Have you tried System.Diagnostics.Process.Start(fullPath) in your button click handler? (Where fullpath is the full file path to your desktop shortcut i.e C:/Users/Me/Desktop/shortcut.lnk)



来源:https://stackoverflow.com/questions/38938775/how-to-use-a-button-click-event-in-c-sharp-to-activate-run-a-desktop-shortcut-to

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