using System;
using System.Diagnostics;
using System.IO;
public static class FileInfoExt
{
public static bool ExecFile(this FileInfo iFileinfo, string iArguments)//todo: test it
{
try
{
if (iFileinfo.Exists)
{
Process ProcessObj = new Process();
ProcessObj.StartInfo.FileName = iFileinfo.FullName;
if (string.IsNullOrEmpty(iArguments) == false)
{
ProcessObj.StartInfo.Arguments = iArguments;
}
ProcessObj.StartInfo.UseShellExecute = false;
ProcessObj.StartInfo.CreateNoWindow = true;
ProcessObj.StartInfo.RedirectStandardOutput = true;
ProcessObj.Start();
return true;
}
}
catch (Exception)
{
}
return false;
}
}