Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Set manual ip address from user input

01 Feb 2017   #1

Windows 7 Professional 64 bit
Set manual ip address from user input

Hi all,

Can someone point out where I've gone wrong with this batch file.

I know it has to be run as an administrator to function correctly.

netsh interface ip set address name="Ethernet" source=dhcp
set /p userInputIP= Enter the 4 DIGIT Number [inc decimal point] (example 90.21) ?
netsh interface ip set address name= ”Ethernet” static 1.%userinputip%.1 1.%userinputip%.254
netsh interface ip set dns “Local Area Connection” static 1.200.300.1
reg add HKLM\System\CurrentControlSet\Services\Tcpip\Parameters /v "SearchList" /d "" /f

The basis here is that a 4 digit number is entered by the user eg: 90.21 which goes into the variable 'userinputip', then this is transferred into the ip address so it becomes

The funny thing is that if I set the static ip in the program it will work.

If I pause the program after it attempt to input the new ip adress, it does look as if it has worked, yet when I check it with ipconfig it shows that it hasn't, returning the dhcp address.

Perhaps what I want isn't possible, if that's the case then I have a few ideas:

The pc name will have numbers in it, like 9021 which can be resolved into a text file from dos using the command echo %computername% > c:\name.txt

This would return pc9021 providing the pc is named pc9021 into a text file, but how would I import the 9021 and make it ??

Hope this makes sense, and thanks in advance for any help.

My System SpecsSystem Spec

 Set manual ip address from user input

Thread Tools

Similar help and support threads
Thread Forum
User Manual For HP Envy 750xt Desktop PC ?
Hi, Am thinking of getting a new HP Envy desktop PC. Their model: "Envy 750 XT" (or maybe it's 750XT) Can't tell you how much time I've spent on their site(s) trying to find a .pdf User Manual I can download for it first. I give up. Whoever is doing their site should be fired.
General Discussion
Please help me with Batch, need manual input required see description
Hi there, I am trying to create a batch file which will use the command nbtstat-a and then request the IP of the user within the same line (e.g. nbtstat-a *please enter the target IP to lookup*) to look up the machine name of a computer on the network, the only problem is that i dont know how to...
General Discussion
Need Help Finding APC BACK-UPS User Manual
I found a APC BACK-UPS 500, model #BK500MUS, in the office I'm working at, and naturally the user manual has been lost for it. I checked APC's website and even called up their tech support, who kindly linked me to the user manual page. However, the BK500 they have on their site is not the same as...
Hardware & Devices
KB911895 HID Non-user Input Data Filter
hi has anyone any advice on this Microsoft optional update please i received today i have not installed it yet. Microsoft - Other hardware - HID Non-User Input Data Filter (KB 911895) Download size: 1.6 MB You may need to restart your computer for this update to take effect. Update...
Windows Updates & Activation
My windows 7 locks-up randomly, but only USER INPUT!
Hello, I am experiencing lockups of my windows configuration, even when reinstalling my windows 7 from scratch. However, when my pc locks, it seems that only the mouse and keyboard freezes, because i see that background tasks are still working: - Drive leds are still flashing - When i was...
BSOD Help and Support

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 20:56.
Twitter Facebook Google+