Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for compname.kix

(view source code of compname.kix as plain text)

  1. If @INWIN <> 2
  2.    ? "CompName.kix,  Version 1.01 for Windows 9x"
  3.    ? "Adjust ComputerName and HostName"
  4.    ?
  5.    ? "Usage:  KIX32  COMPNAME  $NewName=new_computer_name"
  6.    ?
  7.    ? "Written by Rob van der Woude"
  8.    ? "http://www.robvanderwoude.com"
  9.    ?
  10.    EXIT 1
  11. EndIf
  12.  
  13. If InStr( "$NewName", "?" ) > 0
  14.    $NewName = ""
  15. EndIf
  16.  
  17. While $NewName = ""
  18.    ? "Enter the new computer name: "
  19.    GetS $NewName
  20.    If InStr( "$NewName", "?" ) > 0
  21.       $NewName = ""
  22.    EndIf
  23. Loop
  24.  
  25. EXIT
  26.  
  27. ? "ComputerName:"
  28. $OldVal = ReadValue( "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName", "ComputerName" )
  29. ? "Old value = $OldVal"
  30. If @ERROR = 0
  31.    $RC = WriteValue( "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName", "ComputerName", $NewName, "REG_SZ" )
  32.    If @ERROR = 0
  33.       $NewVal = ReadValue( "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName", "ComputerName" )
  34.       ? "New value = $NewVal"
  35.    Else
  36.       ? "Error writing " + Chr(34) + "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName" + Chr(34)
  37.    EndIf
  38. EndIf
  39.  
  40. ? "NetBIOS name:"
  41. $OldVal = ReadValue( "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP", "ComputerName" )
  42. ? "Old value = $OldVal"
  43. If @ERROR = 0
  44.    $RC = WriteValue( "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP", "ComputerName", $NewName, "REG_SZ" )
  45.    If @ERROR = 0
  46.       $NewVal = ReadValue( "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP", "ComputerName" )
  47.       ? "New value = $NewVal"
  48.    Else
  49.       ? "Error writing " + Chr(34) + "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP" + Chr(34)
  50.    EndIf
  51. EndIf
  52.  
  53. ? "TCP/IP host name:"
  54. $OldVal = ReadValue( "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "HostName" )
  55. ? "Old value = $OldVal"
  56. If @ERROR = 0
  57.    $RC = WriteValue( "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "HostName", $NewName, "REG_SZ" )
  58.    If @ERROR = 0
  59.       $NewVal = ReadValue( "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "HostName" )
  60.       ? "New value = $NewVal"
  61.    Else
  62.       ? "Error writing " + Chr(34) + "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP" + Chr(34)
  63.    EndIf
  64. EndIf
  65.  
  66. ?
  67.  

page last uploaded: 2017-04-06, 13:33