I am trying to run a batch file by windows service. The job of the service is to monitor a folder for new files, If it finds then run that batch whose job is to create a log and copy some files.
How ever I can not see that log or any console for that batch (pause is given inside batch file). However no error is also showing apparently. A lot of cmd is open in task manager by the way. Any help. code attached. The batch is ok to run manually.
public partial class CTT : ServiceBase
{
FileSystemWatcher fileWatcher;
public CTT()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
fileWatcher = new FileSystemWatcher(@"E:\Tags\New folder")
{
EnableRaisingEvents = true,
};
fileWatcher.Created += FileWatcher_Created;
}
private void FileWatcher_Created(object sender, FileSystemEventArgs e)
{
Process.Start(@"E:\Tags\TempBatFile.bat");
}
}