Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write string to File

Status
Not open for further replies.

EzehM

Programmer
Feb 27, 2003
86
GB
Please I will like to write the following lines to a file (exactly the way it is below)

if "%1" == "" goto usage
c:\Software\a.exe "FT-CDS-MDI-SCR PP" -i -l %1\%2 %3 -d Messenger -r

I have been messing around with slashes, speech marks etc with no luck (Using StreamWriter). I dont seem to get the exact text!

Any help, or is there a string function that one can pass a set of text and have it written out without any modifications?

Thanks
 
Here is the code:
Code:
using (StreamWriter sw = new StreamWriter("C:\\Temp\\file.out", false, Encoding.Default))
            {
                string line1 = "if \"%1\" == \"\" goto usage";
                string line2 = "c:\\Software\\a.exe    \"FT-CDS-MDI-SCR PP\" -i -l %1\\%2 %3  -d Messenger -r";
                sw.WriteLine(line1);
                sw.WriteLine(line2);
                sw.Close();
            }
obislavu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top