我需要做以下事情:
更改文本文件中的行
[Path] = "c:\this\certain\path\"
用这条线
[Path] = "c:\that\other\newer\path\"
这些路径肯定会有不同的长度,所以我需要更换引号中的内容或完全删除行并输入一个新的,但是在同一个地方,不要附加到文档的末尾.
这样就可以了
Dim thefile As String = "filepath" Dim lines() As String = System.IO.File.ReadAllLines("filepath") lines(number of line you want to replace) = "write what you want to replace here" System.IO.File.WriteAllLines(filepath,lines)