diff --git a/Netch/Netch.cs b/Netch/Netch.cs index 3cefe6f5..93cf2b97 100644 --- a/Netch/Netch.cs +++ b/Netch/Netch.cs @@ -20,8 +20,10 @@ namespace Netch { if (args.Contains("-console")) { - NativeMethods.AllocConsole(); - NativeMethods.AttachConsole(-1); + if (!NativeMethods.AttachConsole(-1)) + { + NativeMethods.AllocConsole(); + } } // 创建互斥体防止多次运行