Forum » Programiranje » preverjanje net povezave z dos batch ukazi
preverjanje net povezave z dos batch ukazi
amigo_no1 ::
Mi lahko nekdo napiše ali vsaj svetuje kako naj to napišem:
ker se mi router vsake toliko časa resetira mi na enem računalniku, ki je prižgan 24/7 ne obnovi net povezave do routerja (wifi povezava od routerja do tega računalnika)
kar pomeni da moram iti do tega računalnika in klikniti na Repair connection (ali Disable in potem Enable)
Malo sem iskal in našel program ki to počne v konzoli
programček:
http://www.novell.com/coolsolutions/too...
napišem tole:
netshx disable "LocalArea Connection"
netshx enable "LocalArea Connection"
in potem net na tem računalniku spet dela (dhcp na routerju je izklopljen , mrežna kartica pa ima ročno vpisane lokalni IP naslov, Subnet mask , Default Gateway ter dns naslova=.
kaj bi rad imel avtomatsko:
da bi računalnika, ki je skozi prižgan vsake npr. pol use poslal ping do routerja (ping 192.168.x.y) ter nato z nekim If stavkom odloči ali je potrebno net povezavo obnoviti (zgoraj 2 napisana ukaza) z zagonom nekega *.BAT fajla, ki bi vseboval zgoraj 2 napisana ukaza
Rabim nekaj takega v dos skriptnem (batch) jeziku
pingaj router vsake pol ure: ping 192.168.x.y
če ni odziva
poženi fajl obnovi_povezavo.bat
Nekaj primerov dos batch programiranja
http://www.ericphelps.com/batch/samples...
ker se mi router vsake toliko časa resetira mi na enem računalniku, ki je prižgan 24/7 ne obnovi net povezave do routerja (wifi povezava od routerja do tega računalnika)
kar pomeni da moram iti do tega računalnika in klikniti na Repair connection (ali Disable in potem Enable)
Malo sem iskal in našel program ki to počne v konzoli
programček:
http://www.novell.com/coolsolutions/too...
napišem tole:
netshx disable "LocalArea Connection"
netshx enable "LocalArea Connection"
in potem net na tem računalniku spet dela (dhcp na routerju je izklopljen , mrežna kartica pa ima ročno vpisane lokalni IP naslov, Subnet mask , Default Gateway ter dns naslova=.
kaj bi rad imel avtomatsko:
da bi računalnika, ki je skozi prižgan vsake npr. pol use poslal ping do routerja (ping 192.168.x.y) ter nato z nekim If stavkom odloči ali je potrebno net povezavo obnoviti (zgoraj 2 napisana ukaza) z zagonom nekega *.BAT fajla, ki bi vseboval zgoraj 2 napisana ukaza
Rabim nekaj takega v dos skriptnem (batch) jeziku
pingaj router vsake pol ure: ping 192.168.x.y
če ni odziva
poženi fajl obnovi_povezavo.bat
Nekaj primerov dos batch programiranja
http://www.ericphelps.com/batch/samples...
zdravc ::
Naredi dve bat proceduri :
preveri.bat
@echo off
:ponovi
ping 192.168.x.y > ping.log
if errorlevel == 1 call obnovi.bat
sleep 600
goto ponovi
obnovi.bat
vpisi svoje ukaze
Ukaz sleep.exe najdes tukaj
preveri.bat
@echo off
:ponovi
ping 192.168.x.y > ping.log
if errorlevel == 1 call obnovi.bat
sleep 600
goto ponovi
obnovi.bat
vpisi svoje ukaze
Ukaz sleep.exe najdes tukaj
kdor zna pa žih
Zgodovina sprememb…
- spremenil: zdravc ()
amigo_no1 ::
Hvala za pomoč
Bom danes testiral če je v redu.
Omogoča dos ukaz PAUSE argument kako dolgo naj miruje ?
PAUSE [nek_čas]
EDIT : S pause ne bo šlo.
http://www.chebucto.ns.ca/~ak621/DOS/Ba...
Bo šlo pa z Choice
Make Your Batch Files Wait a Bit by Using CHOICE. CHOICE has an option to wait `n' seconds and then execute one of the choices as pre-selected by the batch file author. The limit is only 99 seconds, but may be useful if a short delay will suffice. See the `/T' switch option in your DOS documentation.
Bom danes testiral če je v redu.
Omogoča dos ukaz PAUSE argument kako dolgo naj miruje ?
PAUSE [nek_čas]
EDIT : S pause ne bo šlo.
http://www.chebucto.ns.ca/~ak621/DOS/Ba...
Bo šlo pa z Choice
Make Your Batch Files Wait a Bit by Using CHOICE. CHOICE has an option to wait `n' seconds and then execute one of the choices as pre-selected by the batch file author. The limit is only 99 seconds, but may be useful if a short delay will suffice. See the `/T' switch option in your DOS documentation.
Zgodovina sprememb…
- spremenilo: amigo_no1 ()
amigo_no1 ::
Pojavil se je še en nepričakovan problem: ko se požene obnovi.bat, se izvede samo ukaz v prvi vrstici (
netshx disable "LocalArea Connection") , ukaz v drugi vrstici pa ne
fajl obnovi.bat
netshx disable "LocalArea Connection"
netshx enable "LocalArea Connection"
netshx disable "LocalArea Connection") , ukaz v drugi vrstici pa ne
fajl obnovi.bat
netshx disable "LocalArea Connection"
netshx enable "LocalArea Connection"
amigo_no1 ::
Poglej, če napišem v *.bat fajl npr. ukaza:
dir
vol
bosta oba ukaza izvedena.
Problem pri netshx je pa v tem , da je sam fajl netshx.cmd sestavljen iz kupa batch ukazov.
dir
vol
bosta oba ukaza izvedena.
Problem pri netshx je pa v tem , da je sam fajl netshx.cmd sestavljen iz kupa batch ukazov.
zdravc ::
Potem pa naredi vse v prvi proceduri:
:ponovi
sleep 600
ping 192.168.x.y > ping.log
if errorlevel == 1 goto obnovi
goto ponovi
:obnovi
netshx disable "LocalArea Connection"
netshx enable "LocalArea Connection"
goto ponovi
:ponovi
sleep 600
ping 192.168.x.y > ping.log
if errorlevel == 1 goto obnovi
goto ponovi
:obnovi
netshx disable "LocalArea Connection"
netshx enable "LocalArea Connection"
goto ponovi
kdor zna pa žih
bosstjann ::
:ponovi
sleep 600
ping 192.168.x.y > ping.log
if errorlevel == 1 goto obnovi
goto ponovi
:obnovi
start netshx disable "LocalArea Connection"
sleep 30
start netshx enable "LocalArea Connection"
goto ponovi
sleep 600
ping 192.168.x.y > ping.log
if errorlevel == 1 goto obnovi
goto ponovi
:obnovi
start netshx disable "LocalArea Connection"
sleep 30
start netshx enable "LocalArea Connection"
goto ponovi
amigo_no1 ::
Super , sedaj dela OK !
A se vsebina fajla ping.log vsakič ko pinga prepiše ali doda ping_rezultat ?
A se vsebina fajla ping.log vsakič ko pinga prepiše ali doda ping_rezultat ?
Zgodovina sprememb…
- spremenilo: amigo_no1 ()
darkolord ::
Pa pri pingu lahko daš recimo "-n 2 -w 500", da ne traja predolgo da vsi 4 pingi timeoutajo
yeti ::
netshx? morda ti tole pomaga ;)
ipconfig /release
ipconfig /renew
----
C:\>ipconfig /?
USAGE:
ipconfig [/? | /all | /renew [adapter] | /release [adapter] |
/flushdns | /displaydns | /registerdns |
/showclassid adapter |
/setclassid adapter [classid] ]
where
adapter Connection name
(wildcard characters * and ? allowed, see examples)
Options:
/? Display this help message
/all Display full configuration information.
/release Release the IP address for the specified adapter.
/renew Renew the IP address for the specified adapter.
/flushdns Purges the DNS Resolver cache.
/registerdns Refreshes all DHCP leases and re-registers DNS names
/displaydns Display the contents of the DNS Resolver Cache.
/showclassid Displays all the dhcp class IDs allowed for adapter.
/setclassid Modifies the dhcp class id.
The default is to display only the IP address, subnet mask and
default gateway for each adapter bound to TCP/IP.
For Release and Renew, if no adapter name is specified, then the IP address
leases for all adapters bound to TCP/IP will be released or renewed.
For Setclassid, if no ClassId is specified, then the ClassId is removed.
Examples:
> ipconfig ... Show information.
> ipconfig /all ... Show detailed information
> ipconfig /renew ... renew all adapters
> ipconfig /renew EL* ... renew any connection that has its
name starting with EL
> ipconfig /release *Con* ... release all matching connections,
eg. "Local Area Connection 1" or
"Local Area Connection 2"
C:\>
ipconfig /release
ipconfig /renew
----
C:\>ipconfig /?
USAGE:
ipconfig [/? | /all | /renew [adapter] | /release [adapter] |
/flushdns | /displaydns | /registerdns |
/showclassid adapter |
/setclassid adapter [classid] ]
where
adapter Connection name
(wildcard characters * and ? allowed, see examples)
Options:
/? Display this help message
/all Display full configuration information.
/release Release the IP address for the specified adapter.
/renew Renew the IP address for the specified adapter.
/flushdns Purges the DNS Resolver cache.
/registerdns Refreshes all DHCP leases and re-registers DNS names
/displaydns Display the contents of the DNS Resolver Cache.
/showclassid Displays all the dhcp class IDs allowed for adapter.
/setclassid Modifies the dhcp class id.
The default is to display only the IP address, subnet mask and
default gateway for each adapter bound to TCP/IP.
For Release and Renew, if no adapter name is specified, then the IP address
leases for all adapters bound to TCP/IP will be released or renewed.
For Setclassid, if no ClassId is specified, then the ClassId is removed.
Examples:
> ipconfig ... Show information.
> ipconfig /all ... Show detailed information
> ipconfig /renew ... renew all adapters
> ipconfig /renew EL* ... renew any connection that has its
name starting with EL
> ipconfig /release *Con* ... release all matching connections,
eg. "Local Area Connection 1" or
"Local Area Connection 2"
C:\>
amigo_no1 ::
Po dolgem času ponovno odpiram temo:
na enem pcju, kjer je gor OS win xp x64 sp2 in Edimax EW-7128g wifi mrežna kartica imam težave s problemi z netshx:
če odpreš netshx.cmd v notepatu vidiš tole:
( NETSHX NICIDS - regenerate NICIDS.LST for named computer)
Grem po navodilih zgoraj:
namreč vpišem ukaz
, ukaz se izvede OK in ustvari se nov fajl "NICS.LST" (v isti mapi kjer je netshx.cmd )
vsebina fajla:
Potem veselo vpišem v isti mapi ukaz (da vidim če dela):
in dobim ven:
Kaj delam narobe ?
So krivi 64 bitni winsi ?
na enem pcju, kjer je gor OS win xp x64 sp2 in Edimax EW-7128g wifi mrežna kartica imam težave s problemi z netshx:
če odpreš netshx.cmd v notepatu vidiš tole:
( NETSHX NICIDS - regenerate NICIDS.LST for named computer)
Grem po navodilih zgoraj:
namreč vpišem ukaz
NETSHX NICIDS
, ukaz se izvede OK in ustvari se nov fajl "NICS.LST" (v isti mapi kjer je netshx.cmd )
vsebina fajla:
NICID:Edimax 802.11g Wireless PCI Card:HWIDS:PCI\VEN_1814&DEV_0301&SUBSYS_71281432&REV_00:NICFN:WirelessNetwork Connection:
Potem veselo vpišem v isti mapi ukaz (da vidim če dela):
start netshx disable "WirelessNetwork Connection"
in dobim ven:
Disabling WirelessNetwork Connection
PCI\VEN_1814&DEV_0301&SUBSYS_71281432&REV_00\4&3A321F38&0&00F0: Disable failed
No devices disabled.
Kaj delam narobe ?
So krivi 64 bitni winsi ?
Zgodovina sprememb…
- spremenilo: amigo_no1 ()
amigo_no1 ::
Kot kaže je krivec za nedelovanje devcon.exe, ki pri 64-bitnih winsih ne deluje popolnoma ; Ia64\DevCon.exe, ki je znotraj tega paketa pa tudi ne deluje na tem pcju .
http://support.microsoft.com/default.as...
edit:
Tole moram še poskusiti:
http://munashiku.slightofmind.net/20090...
DELA z novim devcon.exe iz "devcon_x64.zip" !
http://support.microsoft.com/default.as...
edit:
Tole moram še poskusiti:
http://munashiku.slightofmind.net/20090...
DELA z novim devcon.exe iz "devcon_x64.zip" !
Zgodovina sprememb…
- spremenilo: amigo_no1 ()
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | Težave - internetOddelek: Omrežja in internet | 1577 (1315) | megy |
» | Spor naslovov IP (strani: 1 2 )Oddelek: Pomoč in nasveti | 12210 (10986) | turob2 |
» | ne morem na modem iskratelOddelek: Pomoč in nasveti | 5358 (4519) | imallears |
» | Ne dela internet na enem računalnikuOddelek: Omrežja in internet | 4008 (3804) | imagodei |
» | Povezava dveh mašin!W2kOddelek: Pomoč in nasveti | 2125 (1937) | ~Panter~ |