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 235 views
1 answer 264 views
1 answer 242 views
1 answer 271 views
1 answer 270 views
2 answers 297 views
1 answer 243 views
...