ProcessStartInfo duplicating code execution

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matt

    #1

    ProcessStartInfo duplicating code execution

    I am running a exe from command line in my application and when I use
    ProcessStartInf o it seems to duplicate all the commands within the function.

    for instance I write a file. Without my ProcessStartInf o the file I write
    does what it is supposed to do and writes 1 file.

    With ProcessStartInf o it writes two files it even creates the random
    ListName for the file twice (different numbers).

    When I go look at it through the debug process and step into it, it doesnt
    show the code being executed twice.

    Any idea whats going on here? Driving me nuts.


    Random R =new Random();
    int MaxLimit = 5000000;
    string ListName = R.Next(MaxLimit ).ToString();
    StreamWriter sr = new StreamWriter("C :\\" + ListName + ".txt");
    sr.Write(PointD ata);
    sr.Close();
    ProcessStartInf o psi = new ProcessStartInf o() ;
    psi.FileName = "C:\\WINPOINT\\ import.exe";
    psi.Arguments = "\"C:\\" + ListName + ".txt\"
    \"P:\\PNTTEMPL\ \DATAIMP\\MMImp ort.imp\" \"P:\\2001\\bor rower\"";
    psi.CreateNoWin dow = false ;
    psi.UseShellExe cute = true;
    psi.WorkingDire ctory = "C:\\WINPOI NT";
    Process.Start( psi ) ;
    psi = null;


Working...