Script task inside a For Each loop - writing to a file

  • My script task is inside a for each loop. I want the script task to write some dynamic string to one file only for all iterations. After every iteration, the file should get appended, not overwritten with the current value of the dynamic string. Its like a logging "tool".

    How do I do this ?

    Here is the script which is inside my for each loop -

    String text = "My text here";

    String path = @"C:\Data\TextFiles\logFile.txt";

    StreamWriter file = new StreamWriter(path, true);

    file.WriteLine(text);

    file.Close();

  • See here.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply