I cannot identify this script , how can I run it. RRS feed

  • Question

  • Im not sure where to put this.

    Im trying to be able to change my nic settings programically. I neet to add an alternate configuration then remove it.

    I found this script but dont know how to run it. I tried to tac .vbs onto it but this did not work.

    I dont know if its right for me but if it does then I can just add my ip addresses and maybe it will solve my problem.

    I got it from here.


    Dim iprangetotal As Integer
     Dim commandprompt As Integer
     Dim i As Integer
     Dim command As String
     commandprompt = Shell("c:\windows\system32\cmd.exe", AppWinStyle.NormalFocus, True, 1000)
     'iprangetotal = 1
     iprangetotal = TxtNumIP.Text
     i = 1
    Do Until i = iprangetotal + 1
     command ="add address " + Chr(34) + "Local Area Connection" + Chr(34) + " addr=" + TxtPartialIP.Text +

    i.ToString + " mask=" + TxtSubnet.Text + " gateway=" + TxtGateway.Text + " gwmetric=5"
     'My.Computer.Keyboard.SendKeys("add address " + Chr(34) + "Local Area Connection" + Chr(34) + "

    addr= mask= gateway= gwmetric=5")
     i = i + 1

    Monday, April 1, 2013 3:16 PM

All replies

  • It looks like a VB.net code snippet rather than VBScript. To run the without rewriting it, it will be easiest to create a new Visual Basic application and then use the code.
    Tuesday, April 2, 2013 3:30 AM
  • While I have written a few scripts, here and there I dont know vb.net. What you seem to be saying is that I really cant run it.

    Particulrly if I dont now vb.net.


    Wednesday, April 3, 2013 1:48 PM
  • Yeah you can't run it as a script without re-writing it.
    Thursday, April 4, 2013 1:15 AM