Batch File to Change Gateway only

Home Forums Scripting DOS Command Shell Batch File to Change Gateway only

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    Broderic
    Member
    #161870

    Hi there, i have a network with 40 pc and two gateways what i need is a bat file to redirect torrent traffic to one specific gateway the problem is that each pc has a static ip and i don’t want to modify any setting except gateway so what i have done till now is this :


    @echo
    off
    taskkill /F /IM utorrent.exe
    netsh interface ip set address name=”Local Area Connection” source=dhcp gateway=192.168.1.130 gwmetric=1
    start /wait C:Progra~2uTorrentutorrent.exe
    netsh interface ip set address name=”Local Area Connection” source=dhcp gateway=192.168.1.1 gwmetric=1
    exit
    [/CODE]
    but his doesnt work cause it changes ip and net mask to dhcp instead of just changing gateway

    So what i have in mind is to use command ipconfig > C:ip.txt then use a findstr 0.0.0.0 to find the static values for ip, subnetmask and then paste each value like netsh interface ip set address name=”Local Area Connection” source=static addr=% mask=% gateway=192.168.1. gwmetric=1
    i have the general concept just cant do it
    I appreciate any help[CODE]

    @echo
    off
    taskkill /F /IM utorrent.exe
    netsh interface ip set address name=”Local Area Connection” source=dhcp gateway=192.168.1.130 gwmetric=1
    start /wait C:Progra~2uTorrentutorrent.exe
    netsh interface ip set address name=”Local Area Connection” source=dhcp gateway=192.168.1.1 gwmetric=1
    exit
    [/CODE]
    but his doesnt work cause it changes ip and net mask to dhcp instead of just changing gateway

    So what i have in mind is to use command ipconfig > C:ip.txt then use a findstr 0.0.0.0 to find the static values for ip, subnetmask and then paste each value like netsh interface ip set address name=”Local Area Connection” source=static addr=% mask=% gateway=192.168.1. gwmetric=1
    i have the general concept just cant do it
    I appreciate any help

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.