How can I create shortcuts to Windows files and folders using C # .NET code?

I am creating a repository folder and file structure with many dependencies in version control using .NET for our data warehouse. I currently have code for creating dummy files and folders with C # code (see below). However, there are common objects. Therefore, I would like to create shortcuts for Windows files and shortcuts for Windows folders as well as files. What would C # code look like for this?

Create a folder using C # .NET code:

string activeDir = @"C:\Source\EDW\dw-objects\trunk\table-objects"; string objectName = reader[0].ToString(); string newPath = System.IO.Path.Combine(activeDir, objectName); System.IO.Directory.CreateDirectory(newPath); 

Code varies depending on files based on format

+2
c # windows svn shortcut
source share
2 answers

Please use ShellClass to create shortcuts, and you will need to get a special directory from the desktop using Environment.SpecialFolder.DesktopDirectory

A very good example, showing step-by-step, can be found here http://www.codeproject.com/Articles/146757/Add-Remove-Startup-Folder-Shortcut-to-Your-App

+4
source share

Take a look at this article shows you how to manage NTFS junction points using C #. Since you want to access folders, you will need junction points, not shrotcuts, since they are followed by machine processing, and the other is not.

+2
source share

All Articles