Skip to main content
The 2024 Developer Survey results are live! See the results

you can use the Enviroment.SpecialFolder enum, although depending on your requirements you might lookslook at creating a windows service instead of an app that has to start on startup.

File.Copy("shortcut path...", Environment.GetFolderPath(Environment.SpecialFolder.Startup) + shorcutname);

edit:

File.Copy just takes aneeds an origin file fromdirectory-path and file to paththe target directory-path to copy a file. The key in that snippet is Enviroment.GetFolderPath(Enviroment.SpecialFolder.Startup) which is getting the startup folder path where you want to copy your file to.

you could use the above code several ways. If you hadIn case you've got an installer project for your app, you could run something like this on install. Another way could be when the app launches it checks if the shorcut exists there and puts one there if not (File.Exists()).

Here is a question about creating shortcuts in code also.

you can use the Enviroment.SpecialFolder enum, although depending on your requirements you might looks at creating a windows service instead an app that has to start on startup.

File.Copy("shortcut path...", Environment.GetFolderPath(Environment.SpecialFolder.Startup) + shorcutname);

edit:

File.Copy just takes a file from and file to path to copy a file. The key in that snippet is Enviroment.GetFolderPath(Enviroment.SpecialFolder.Startup) getting the startup folder path to copy to.

you could use the above code several ways. If you had an installer project for your app, you could run something like this on install. Another way could be when the app launches it checks if the shorcut exists there and puts one there if not (File.Exists()).

Here is a question about creating shortcuts in code also.

you can use the Enviroment.SpecialFolder enum, although depending on your requirements you might look at creating a windows service instead of an app that has to start on startup.

File.Copy("shortcut path...", Environment.GetFolderPath(Environment.SpecialFolder.Startup) + shorcutname);

edit:

File.Copy needs an origin file directory-path and the target directory-path to copy a file. The key in that snippet is Enviroment.GetFolderPath(Enviroment.SpecialFolder.Startup) which is getting the startup folder path where you want to copy your file to.

you could use the above code several ways. In case you've got an installer project for your app, you could run something like this on install. Another way could be when the app launches it checks if the shorcut exists there and puts one there if not (File.Exists()).

Here is a question about creating shortcuts in code also.

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

you can use the Enviroment.SpecialFolder enum, although depending on your requirements you might looks at creating a windows service instead an app that has to start on startup.

File.Copy("shortcut path...", Environment.GetFolderPath(Environment.SpecialFolder.Startup) + shorcutname);

edit:

File.Copy just takes a file from and file to path to copy a file. The key in that snippet is Enviroment.GetFolderPath(Enviroment.SpecialFolder.Startup) getting the startup folder path to copy to.

you could use the above code several ways. If you had an installer project for your app, you could run something like this on install. Another way could be when the app launches it checks if the shorcut exists there and puts one there if not (File.Exists()).

HereHere is a question about creating shortcuts in code also.

you can use the Enviroment.SpecialFolder enum, although depending on your requirements you might looks at creating a windows service instead an app that has to start on startup.

File.Copy("shortcut path...", Environment.GetFolderPath(Environment.SpecialFolder.Startup) + shorcutname);

edit:

File.Copy just takes a file from and file to path to copy a file. The key in that snippet is Enviroment.GetFolderPath(Enviroment.SpecialFolder.Startup) getting the startup folder path to copy to.

you could use the above code several ways. If you had an installer project for your app, you could run something like this on install. Another way could be when the app launches it checks if the shorcut exists there and puts one there if not (File.Exists()).

Here is a question about creating shortcuts in code also.

you can use the Enviroment.SpecialFolder enum, although depending on your requirements you might looks at creating a windows service instead an app that has to start on startup.

File.Copy("shortcut path...", Environment.GetFolderPath(Environment.SpecialFolder.Startup) + shorcutname);

edit:

File.Copy just takes a file from and file to path to copy a file. The key in that snippet is Enviroment.GetFolderPath(Enviroment.SpecialFolder.Startup) getting the startup folder path to copy to.

you could use the above code several ways. If you had an installer project for your app, you could run something like this on install. Another way could be when the app launches it checks if the shorcut exists there and puts one there if not (File.Exists()).

Here is a question about creating shortcuts in code also.

added 643 characters in body
Source Link
Patrick Kafka
  • 9.9k
  • 4
  • 30
  • 44

you can use the Enviroment.SpecialFolder enum, although depending on your requirements you might looks at creating a windows service instead an app that has to start on startup.

File.Copy("shortcut path...", Environment.GetFolderPath(Environment.SpecialFolder.SystemStartup) + shorcutname);

edit:

File.Copy just takes a file from and file to path to copy a file. The key in that snippet is Enviroment.GetFolderPath(Enviroment.SpecialFolder.Startup) getting the startup folder path to copy to.

you could use the above code several ways. If you had an installer project for your app, you could run something like this on install. Another way could be when the app launches it checks if the shorcut exists there and puts one there if not (File.Exists()).

Here is a question about creating shortcuts in code also.

you can use the Enviroment.SpecialFolder enum, although depending on your requirements you might looks at creating a windows service instead an app that has to start on startup.

File.Copy("shortcut path...", Environment.GetFolderPath(Environment.SpecialFolder.System) + shorcutname);

you can use the Enviroment.SpecialFolder enum, although depending on your requirements you might looks at creating a windows service instead an app that has to start on startup.

File.Copy("shortcut path...", Environment.GetFolderPath(Environment.SpecialFolder.Startup) + shorcutname);

edit:

File.Copy just takes a file from and file to path to copy a file. The key in that snippet is Enviroment.GetFolderPath(Enviroment.SpecialFolder.Startup) getting the startup folder path to copy to.

you could use the above code several ways. If you had an installer project for your app, you could run something like this on install. Another way could be when the app launches it checks if the shorcut exists there and puts one there if not (File.Exists()).

Here is a question about creating shortcuts in code also.

Source Link
Patrick Kafka
  • 9.9k
  • 4
  • 30
  • 44
Loading