0

i created a desktop icon (shortcut) for a URL (lets say a google.com shortcut on my desktop), so that when i click on it , IE opens and launches google.com website.

is there anyway to program the second part ? i am looking for the code to just click on that shortcut and somehow launch that page . thanks

developi
  • 19
  • 6
  • How is this a coding question? – rory.ap Mar 29 '17 at 18:49
  • Possible duplicate of: http://stackoverflow.com/questions/6141821/run-application-via-shortcut-using-process-start-c-sharp – Bill W Mar 29 '17 at 18:56
  • Possible duplicate of [Run application via shortcut using Process.Start C#](http://stackoverflow.com/questions/6141821/run-application-via-shortcut-using-process-start-c-sharp) – Bill W Mar 29 '17 at 19:20

1 Answers1

1
Process.Start("cmd", @"/c %UserProfile%\Desktop\fileName.ext");

This will open cmd.exe(command prompt) and pass the /c arguement to it followed by a command. This essentially executes the command followed by /c.

Doing this will essentially do the same thing as double-clicking on the file.