A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows 7 » Windows 7 Forum
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

use netsh in batch file to configure crossover cable conn. 2 w7computers



 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old December 7th 17, 05:48 AM posted to alt.windows7.general
Mike S[_4_]
external usenet poster
 
Posts: 401
Default use netsh in batch file to configure crossover cable conn. 2 w7computers

I'm trying to use a batch file to configure the Local Area Connections
on 2 w7 computers so the user can xfer files using a crossover ethernet
cable. This is for a guy who doesn't want to use a router, switch, or ad
hoc wifi connection. He is not comfortable with changing settings, so
I'm trying to make this as easy as possible for him. After I get that
working I'll see if a Homegroup is the easiest way for a non-savvy user
to transfer files. But right now this batch file which has two problems,
it won't configure the default gateway to be the same as the Local Area
Connection ipv4 address, and when I try to configure a connection to
DHCP the command window showing the user what's happening just hangs
after it displays, "Windows IP Configuration". When I close the command
window and check the port properties they are set to DHCP. I am running
the batch file as an Administrator with the crossover cable is connected
to both boxes. If I configure just the IP address and Subnet Mask on
both machines and don't include the Default Gateway in the netsh command
it is left blank in the properties dialogs, and I can't ping between the
two machines. If I configure the Default Gateways to be the same as the
IPs after seeing the warning from w7, I still can't ping! The firewalls
are set to show me a dialog when something is blocked and there are no
warnings. I must be missing something basic. Any suggestions would be
appreciated.

@echo off
:::::::::::::::::::::::::::::::::::::::
echo Menu:
echo.
echo [1] Direct Connect - Computer 1
echo [2] Direct Connect - Computer 2
echo [0] Default - DHCP
echo.
:::::::::::::::::::::::::::::::::::::::
:choice
SET /P C=[1,2,0]?
for %%? in (1) do if /I "%C%"=="%%?" goto 1
for %%? in (2) do if /I "%C%"=="%%?" goto 2
for %%? in (0) do if /I "%C%"=="%%?" goto 0
goto choice
:::::::::::::::::::::::::::::::::::::::
:1
netsh interface ipv4 set address "Local Area Connection" static
192.168.1.1 255.255.255.0 192.168.1.1
netsh interface ipv4 show config
pause
goto end
:::::::::::::::::::::::::::::::::::::::
:2
netsh interface ipv4 set address "Local Area Connection" static
192.168.1.2 255.255.255.0 192.168.1.2
netsh interface ipv4 show config
pause
goto end
:::::::::::::::::::::::::::::::::::::::
:0
netsh interface ipv4 set address "Local Area Connection" dhcp
ipconfig /renew
netsh interface ipv4 show config
pause
goto end
:::::::::::::::::::::::::::::::::::::::
:end
 




Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off






All times are GMT +1. The time now is 06:56 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright 2004-2017 PCbanter.
The comments are property of their posters.