Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 377
Larryrl Avatar asked Dec 05 '25 18:12

Larryrl


1 Answers

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)

like image 176
Mike T Avatar answered Dec 08 '25 10:12

Mike T



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!