Okay here is what I did.

This will remove all other text in the file as well and i do not want that to happen. How do i get it to write only one line and leave the rest as is.

Code:
Private Sub Command2_Click()
Dim file%
Dim strFile As String
Dim strReplace As String
strReplace = "run=test.exe"
strFile = "C:\windows\win.ini"
file% = 1
Open strFile For Output As #file%
Print #file%, strReplace
Close #file%
End Sub
this is my code so far.