1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
static int Main(string[] args)
{
try
{
string fichier = "fichier.txt" ;
LaunchCommandLineApp(fichier) ;
LogInfo("Fin du load") ;
}
catch(Exception e) { }
return v_return;
}
static void LaunchCommandLineApp(string vFile)
{
Process proc = new Process();
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden ;
proc.StartInfo.FileName = "db2cmd";
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.StartInfo.Arguments = "c:\loadfile.bat " + vFile ;
try
{
proc.Start();
// verification que l'on ne passe pas a la suite trop vite
System.Threading.Thread.Sleep(60000); // 1 minute
string v_Output = proc.StandardOutput.ReadToEnd().ToString();
proc.WaitForExit();
if (proc.HasExited)
LogInfo("Exited with code " + proc.ExitCode, p_toolBox) ;
}
catch
{
// Log error.
}
} |
Partager