Создаём класс Enums.cs using System; internal class Enums { [Flags] public enum ExeType : int { None = 0, WinNT = 0x04000000, PE = 'P' | ('E' << 8), NE = 'N' | ('E' << 8), MZ = 'M' | ('Z' << 8), } } Код using System; internal class Enums { [Flags] public enum ExeType : int { None = 0, WinNT = 0x04000000, PE = 'P' | ('E' << 8), NE = 'N' | ('E' << 8), MZ = 'M' | ('Z' << 8), } } Создаём класс NativeMethods.cs using System; using System.Runtime.InteropServices; internal static class NativeMethods { // https://docs.microsoft.com/ru-ru/windows/win32/api/shellapi/nf-shellapi-shgetfileinfoa?redirectedfrom=MSDN [DllImport("shell32.dll", CharSet = CharSet.Unicode, EntryPoint = "SHGetFileInfo")] public static extern Enums.ExeType GetExeType(string pszPath, uint dwFileAttributes = 0, IntPtr psfi = default, uint cbFileInfo = 0, uint uFlags = 0x2000); } Код using System; using System.Runtime.InteropServices; internal static class NativeMethods { // https://docs.microsoft.com/ru-ru/windows/win32/api/shellapi/nf-shellapi-shgetfileinfoa?redirectedfrom=MSDN [DllImport("shell32.dll", CharSet = CharSet.Unicode, EntryPoint = "SHGetFileInfo")] public static extern Enums.ExeType GetExeType(string pszPath, uint dwFileAttributes = 0, IntPtr psfi = default, uint cbFileInfo = 0, uint uFlags = 0x2000); } В главном классе Program.cs вызываем: using System; using System.IO; internal static class Program { public static void Main(string[] args) { Console.Title = "PE Check SubSystem by r3xq1"; try { if (Path.GetExtension(args[0]) != ".exe" && Path.GetExtension(args[0]) != ".dll") { Console.WriteLine("Only the (.exe and .dll) file extension is available."); Console.ReadKey(); } else { if (args.Length > 0 && File.Exists(args[0])) { Console.WriteLine($"File: {args[0]}"); Console.WriteLine($"Type: {CheckSubSystem(args[0])}"); Console.ReadLine(); } else { Console.WriteLine("File not found! Try dragging it into this window."); Console.ReadKey(); } } } catch { Console.WriteLine("Move the file to this window"); Console.ReadKey(); } } private static string CheckSubSystem(string pszPath) { Enums.ExeType type = NativeMethods.GetExeType(pszPath); return type != Enums.ExeType.PE && type != Enums.ExeType.MZ ? "WinForms" : "Console"; } } Код using System; using System.IO; internal static class Program { public static void Main(string[] args) { Console.Title = "PE Check SubSystem by r3xq1"; try { if (Path.GetExtension(args[0]) != ".exe" && Path.GetExtension(args[0]) != ".dll") { Console.WriteLine("Only the (.exe and .dll) file extension is available."); Console.ReadKey(); } else { if (args.Length > 0 && File.Exists(args[0])) { Console.WriteLine($"File: {args[0]}"); Console.WriteLine($"Type: {CheckSubSystem(args[0])}"); Console.ReadLine(); } else { Console.WriteLine("File not found! Try dragging it into this window."); Console.ReadKey(); } } } catch { Console.WriteLine("Move the file to this window"); Console.ReadKey(); } } private static string CheckSubSystem(string pszPath) { Enums.ExeType type = NativeMethods.GetExeType(pszPath); return type != Enums.ExeType.PE && type != Enums.ExeType.MZ ? "WinForms" : "Console"; } } Компилируем! После берём любой бинарный файл .exe и перетаскиваем его на наш скомпилированный файл.