Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 687

Exit VB-Scritp after Time X

$
0
0
Hi,

I'm using a very simple script to change the computername in Win7.
But if the User didn't enter the new Computername, the scipt never stops.
How can I exit the script after a specific time?? eg. 10 Minutes.
Thanks for your help.


Option Explicit

Set ws = WScript.CreateObject("WScript.Shell")
Dim ws, t, p2, p3, p4, p5, n, g, j, h, f, k, cn, cg, cj
Dim itemtype

p2 = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName\"
p3 = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters\"
p4 = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\"
p5 = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\"

j = ws.RegRead(p2 & "ComputerName")
h = ws.RegRead(p3 & "NV Hostname")
f = ws.RegRead(p4 & "ComputerName")
k = ws.RegRead(p5 & "NV Hostname")

t = "Change Utility"

cj = InputBox("Type new Computer name and click OK.", t, j)

If cj <> "" Then
ws.RegWrite p2 & "ComputerName", cj
ws.RegWrite p3 & "NV Hostname", cj
ws.RegWrite p4 & "ComputerName", cj
ws.RegWrite p5 & "NV Hostname", cj
End If

Viewing all articles
Browse latest Browse all 687

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>