thiago costa

thiago costa

  • NA
  • 319
  • 0

How to Read, Modify, Save specific line in a .txt file c# ?

Sep 27 2011 10:40 PM
Hello there guys, sorry to bother you...
I got stuck on a small problem due to my little knowledge.
I have this file (program.txt)


:SHORTSOURCEMENU
REM -- MENU --
RAFAS
RAFASD


:SOURCESELECT
IF "%SOURCEDOT%" == "124" SET SOURCE=enUS
IF "%SOURCEDOT%" == "125" SET SOURCE=esMX
IF "%SOURCEDOT%" == "126" SET SOURCE=ptBR
IF "%SOURCEDOT%" == "127" SET SOURCE=enGB


I want lile 3 (rafas, to become):
set SOURCE=124

I want line 4 (rafasd, to become):

set SOURCEDOT=124

Now that the file has been written the way it will work, I need to rename program.txt to program.bat.

OR, I could CREATE a new file called program.bat instead of renaming, even better :D

Thanks guys



Answers (2)