Files
2019-04-28 19:05:59 +01:00

36 lines
1.0 KiB
C#

using System.IO;
using System.Threading;
// This is a test process used for testing configuring running and stopping a process on a machine
namespace WindowsProcessTestProcess
{
class Program
{
static void Main(string[] args)
{
string[] lines = { "Test line1", "Test line2", "Test line3" };
if (args.Length > 0)
{
string filePath = args[0];
using (StreamWriter outputFile = new StreamWriter(filePath))
{
// Write to a log file so that we can see if the process ran
foreach (var line in lines)
{
outputFile.WriteLine(line);
}
}
}
if (args.Length <= 1 || (args.Length > 1 && args[1] != "Stop Running"))
{
// Sleep so that the process stays running until it is killed
Thread.Sleep(Timeout.Infinite);
}
}
}
}