to add ip address in host file i have the code but i don’t have the code to remove any entry.the code for adding is:
For Machines with Windows 95, 98, NT or 2000 click here →
Sub Click(Source As Button)
'Dim session As New NotesSession
'Dim db As NotesDatabase
Dim fileNum As Integer
Dim fileName As String
'Set db = session.CurrentDatabase
fileNum% = Freefile()
'envir = Environ("SystemRoot") 'Get the location where windows is installed
lsWindowsDir = Environ$("windir")
lsWindowsDir = Lcase$(lsWindowsDir)
If lsWindowsDir = "c:\windows" Then
filename = "c:\windows\hosts"
Else
filename = "c:\winnt\system32\drivers\etc\hosts"
End If
Open filename For Append As fileNum%
’ Print two lines to the file and close it.
’ First line: two String values, with no separation between.
'Print #fileNum%,"176.0.0.41 myportal.tatasteel.co.in"
Print #fileNum%,"176.0.0.17 myportal.tatasteel.co.in"
’ Second line: NULL value, EMPTY value, Integer variable
’ value, and String value, separated on the line by tabs.
'Print #fileNum%, nVar, eVar, fileNum%, "corrupted"
Close fileNum%
Msgbox " My Portal added to your host file.Thanks "
End Sub
AND For Windows XP machine( all black coloured new machines) →
Sub Click(Source As Button)
'Dim session As New NotesSession
'Dim db As NotesDatabase
Dim fileNum As Integer
Dim fileName As String
'Set db = session.CurrentDatabase
fileNum% = Freefile()
'envir = Environ("SystemRoot") 'Get the location where windows is installed
lsWindowsDir = Environ$("windir")
lsWindowsDir = Lcase$(lsWindowsDir)
filename = "c:\windows\system32\drivers\etc\hosts"
Open filename For Append As fileNum%
’ Print two lines to the file and close it.
’ First line: two String values, with no separation between.
’ Print #fileNum%,“176.0.0.41 myportal.tatasteel.co.in”
Print #fileNum%,"176.0.0.17 myportal.tatasteel.co.in"
’ Second line: NULL value, EMPTY value, Integer variable
’ value, and String value, separated on the line by tabs.
'Print #fileNum%, nVar, eVar, fileNum%, "corrupted"
Close fileNum%
Msgbox " My Portal added to your host file.Thanks "
End Sub
if u can than plz help me out from this poblem