I want to block the user from running an exe file by double clicking it.The exe file only executes with the help of the command prompt.When the user double clicks the exe the args value will be null.
static void Main(string[] args)
{
//Preventing the Exception
if (args.Length > 0)
Application.Run(new Form1(args[0]));
else
MessageBox.Show("This File Can Only Run In CMD");
//Apporach2 Handelling the Exception
try
{
Application.Run(new RecycleBinCleaner(args[0]));
}
catch (Exception e)
{
MessageBox.Show("This File Can Only Run In CMD");
}
}