I made a C # application, in addition to performing the basic functions, I want to be able to run with batch scripts, but the problem is that I run Console.WriteLine
and it does not write anything in the CMD window.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Programs
{
static class Program
{
static Mutex mutex = new Mutex(true, "TS4");
///
/// The main entry point for the application.
///
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (mutex.WaitOne(TimeSpan.Zero, true))
{
if (args.Length > 0)
{
Application.Run(new Form_Install());
}
else
{
Trace.WriteLine("Missing Var packed_filename");
Trace.WriteLine("Missing Var packed_game");
Trace.WriteLine("Missing Var packed_type");
MessageBox.Show("Parâmetros não encontrados.");
}
mutex.ReleaseMutex();
Trace.WriteLine("Mutex foi lançado!");
}
else
{
MessageBox.Show("Erro ao processar solicitação! O aplicativo já está em execução, termine a outra instalação e tente novamente!" , "O Thread atual já está em uso!" , MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
I also heard about Trace.WriteLine
, but it did not work either!