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. |
|
|
Thread Tools | Rate Thread | Display Modes |
#1
|
|||
|
|||
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 |
|
|