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 238 views
1 answer 267 views
1 answer 245 views
1 answer 273 views
1 answer 274 views
2 answers 299 views
1 answer 247 views
...