Get the application exe name
This came up on an internal alias recently…. Nothing earth shattering here, but I figured it might help someone googling for an answer someday… Hey, if it did, drop me a comment and let me know about it…
Question:
I just want the exe name of a console application but have no idea where its at.
For example:
In C++:
#include <iostream.h>
int main(int argc, char* argv[])
{
cout<<argv[0]; //This will give you the exe name
}
Answer:
In C#
class Class1
{
static void Main(string[] args)
{
Console.WriteLine (Environment.GetCommandLineArgs()[0]);
}
}