How to get the current executable name in C#

1 Answer

0 votes
using System;
using System.IO;

class Program
{
    static void Main()
    {
        var path = Environment.CommandLine;
        
        var s = Path.GetFileName(path);

        Console.WriteLine(s);
    }
}


 
/*
run:
 
Main.exe
 
*/

 



answered Jun 3, 2025 by avibootz

Related questions

2 answers 242 views
1 answer 269 views
1 answer 247 views
1 answer 275 views
1 answer 275 views
2 answers 304 views
1 answer 250 views
...