Exercise
Display executable files in directory
Objetive
Create a program that shows the names (excluding the path) of all executable files (.com, .exe, .bat, .cmd) in the current folder.
Example Code
using System;
using System.IO;
class DisplayExecutableFiles
{
static void Main()
{
string[] files = Directory.GetFiles(".");
foreach (string file in files)
{
string extension = Path.GetExtension(file);
switch (extension)
{
case ".exe":
case ".com":
case ".bat":
case ".cmd":
Console.WriteLine(file);
break;
}
}
}
}