Jump to content

Recommended Posts

Posted

I am try to add an optin to set static ip on my winpe hta menu...

For thisI use a vbs script to run netsh ,,Please tel me what I am doing wrong!!!

when I run thsi vbs the error is like the following command was not find .

SetIp.vbs

 
'********************************************************************
'* File: StaticIp.vbs
'* Author: CodeMan
'* dicky2k5@gmail.com
'* Created: May 2007
'* Version: 2
'* Description: Seting Static IP
''* Dependencies: To Use on Win Pe2
'********************************************************************
Option Explicit
Dim strTaskValue, objShell, objFso, objWmiService, strOutPut
Dim strIP, strSub, strGtw
Set objShell = CreateObject("WScript.Shell")
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject ("winmgmts:\\.\root\cimv2")

'****************************************************************************
'*SetIp
'****************************************************************************
'Sub RunSetip
strIP = inputbox ("Please enter the IP Address.","192.168.1.11","192.168.1.11")
strSub = inputbox ("Please enter the Subnet Mask.","255.255.255.0","255.255.255.0")
strGtw = inputbox ("Please enter the Gate Way.","192.168.1.1","192.168.1.1")
'Msgbox "netsh int ip addr set local static "& strIP & " "& strSub & " "& strGtw & " "
objShell.Run "%comspec% /k netsh int ip addr set local static "&strIP & " "& strSub & " "& strGtw & " ",1, false
Msgbox "Whois Me-->IP--> " & strIP & " MASK--> "& strSub & " G'WAY-->"& strGtw & " "
'End

'****************************************************************************

post-23626-1180345903_thumb.jpg


Posted

Your syntax is all wrong. The command you're trying to call doesn't exist. In a command prompt, type netsh. Once you're in the shell type 'help' for more help on syntax. Your command needs to be something like this:

objShell.Run "%comspec% /k netsh interface ipv4 set address 'Local Area Connection' static " & strIP & " " & strSub & " " & strGtw,1, false

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...