Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8119245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:44:50+00:00 2026-06-06T04:44:50+00:00

I know how to create a symbolic link in windows in a .bat script:

  • 0

I know how to create a symbolic link in windows in a .bat script:

mklink /J <LinkPath> <OriginalResourcePath>

How to do the same thing in C# ?

I’ve not been happy with the googling, because i’m a beginner in C# and I probably don’t use the right terms. Anybody can indicate the API to use please ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:44:52+00:00Added an answer on June 6, 2026 at 4:44 am

    Warning: The question is not clear as it refers to symbolic links but at the same time refers to the /J switch that is used to create a junction. This answer refers to "how to create a symbolic link in c#" (without the /J). Instead, For creating junctions, please refer to In .NET, how do I Create a Junction in NTFS, as opposed to a Symlink?.

    This is how symbolic links can be created:

    using System.Runtime.InteropServices;
    using System.IO;
    
    namespace ConsoleApplication
    {
        class Program
        {
            [DllImport("kernel32.dll")]
            static extern bool CreateSymbolicLink(
            string lpSymlinkFileName, string lpTargetFileName, SymbolicLink dwFlags);
    
            enum SymbolicLink
            {
                File = 0,
                Directory = 1
            }
    
            static void Main(string[] args)
            {
                string symbolicLink = @"c:\bar.txt";
                string fileName = @"c:\temp\foo.txt";
    
                using (var writer = File.CreateText(fileName))
                {
                    writer.WriteLine("Hello World");
                }
    
                CreateSymbolicLink(symbolicLink, fileName, SymbolicLink.File);
            }
        }
    }
    

    This will create a symbolic link file called bar.txt on the C:-drive which links to the foo.txt text file stored in the C:\temp directory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know it's possible to create a dynamically changable Default.png by creating a symbolic
In my Xcode project, I've created a symbolic link script in the target that
What kind of skills should a WPF developer know to create MVVM applications? Things
I know how to create simple object and add dynamically properties to it. object
I know how to create and apply styles and themes thanks to http://developer.android.com/guide/topics/ui/themes.html .
I know how to create a histogram (just use with boxes) in gnuplot if
I know how to create a PrintWriter and am able to take strings from
I know how to create a job dynamically from this create-sql-server-job-automatically The issue I
I know I can create a plot with line and dots using the type
Does anyone know how to create an entire database from a visual studio database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.