scripting@wanadoo.nl




HostsInstall()

http://www.scriptlogic.com/kixtart/FunctionLibrary_FunctionList.aspx


actual FunctionLibrary list on 'Scriptlogic' site printer-friendly mirror of UDF topic on 'scripting@wanadoo.nl' site close
4 February 2003 HostsInstall()
AuthorKent Dyer
Action Checks for an IP Address and alias name. If needed, it will update.
SyntaxHostsInstall () 
Parameters 
Remarksuser would need Power User or Administrative Access to modify the HOSTS file. 
ReturnsNothing 
DependenciesNone. 
Examples
$rc=HostsInstall()

 
Source
FUNCTION HostsInstall ()
  $hostsdir='%windir%\system32\drivers\etc'
  $hostsdirfile=$hostsdir+'\hosts' ;This is setup with IP Address and Alias of the Server
  $ipalias='1.2.3.4'+Chr(9)+Chr(9)+'installs'
  IF Exist($hostsdirfile)
    $=Open(1,$hostsdirfile)
    $line=ReadLine(1)
    WHILE (@error=0) AND ($ip <> 'found')
      IF ($line = $ipalias)
        $ip='found'
      ENDIF
      $line=ReadLine(1)
    LOOP
    $=Close(1)
    IF ($ip <> 'found')
      $=Open(2,$hostsdirfile,5)
      $=WriteLine(2,$ipalias+@crlf)
      $=Close(2)
    ENDIF
  ELSE
    ;--HOSTS is not found, copy one over
    COPY @ldrive+'HOSTS' $hostsdir
  ENDIF
ENDFUNCTION ; - HostsInstall -
 
  original source of UDF topic. show actual FunctionLibrary list on Scriptlogic site close top
          printer-friendly mirror of UDF topic on scripting@wanadoo.nl site  




Copyright © 2003 www.scriptlogic.com & scripting@wanadoo.nl - last updated on 20 May 2003


Site Meter