Jump to content

Yerel Ağ Bağlantısını Bat,autoit Ile Kapatma


 Share

Recommended Posts

Değerli arkadaşlarım 2-3 gündür kafayı buna taktım.
Başlat>Denetim Masası>Ağ ve Paylaşım Merkezi>Bağdaştırıcı Ayarları yoluyla ulaşılan [b]Yerel Ağ Bağlantısı[/b]na sağ tıklayıp devre dışı bırak deyince devre dışı kalıyor.Tam tersinde de Etkinleştir deyince Etkinleşiyor.Ben diyorum ki bir bat dosyası
veya autoit koduyla bu işlemi kolaylaştıramaz mıyız?2 dosya olacak biri kapatacak diğeri ise açacak.İnternetin altını üstüne getirdim ama sonuç yok.Yardımcı olursanız memnun olurum.Saygılarımla
Link to comment
Share on other sites

Şu kodları bat şeklinde yapın ;)

[b]Kapamak İçin:[/b]
[code]netsh interface set interface "Yerel Ağ Bağlantısı" Disable[/code]
[b]Açmak İçin:[/b]
[code]netsh interface set interface "Yerel Ağ Bağlantısı" Enable[/code]

[b]Wifi açma:[/b]
[code]netsh interface set interface "Kablosuz Ağ Bağlantısı" Enable[/code]
[b]Wifi Kapa:[/b]
[code]netsh interface set interface "Kablosuz Ağ Bağlantısı" Disable[/code]

Edited by milano88
Link to comment
Share on other sites

Milano88 verdiğiniz kod ilk anda işe yaaramadı.Ama Yerel Ağ Bağlantısı ismindeki Türkçe karakterler nedeniyle olmamış.[b]Yerel Ağ Bağlantısı[/b] ismini değiştirip [b]YAGMUR[/b] yazdım.Ve bat dosyasına da bunu yazdım.Ve oldu.Gerçekten teşekkür ederim.

Ben paylaşayım.Kodun içinden tırnk içine alınmış olan YAGMUR kelimesi yerine sizin Yerel Ağ Bağlantısına (Türkçe karakter içermeyen) verdiğiniz ismi yazınız.

Kapatmak İçin:

netsh interface set interface "YAGMUR" Disable

Yeniden Açmak İçin:

netsh interface set interface "YAGMUR" Enable

Link to comment
Share on other sites

Bat Dosyasına çevirdim. Kodları metin belgesine yapıştırıp .bat olarak kaydedin.

[img]http://i.imgur.com/HHd2G.png[/img]

[codebox]@echo off
color 6
title Baglanti Ac/Kapa
echo.
echo Internet Baglantisini Ac/Kapat Programi
echo.
echo 1.Baglantiyi Ac
echo.
echo 2.Baglantiyi Kapat
echo.
echo 3.Kablosuz Baglantiyi Ac
echo.
echo 4.Kablosuz Baglantiyi Kapat
echo.
echo 5.Cikis
echo.

set /p secim="Bir Secim Yapin ve Enter'a Basin:"
if %secim% == 1 goto ag_ac
if %secim% == 2 goto ag_kapa
if %secim% == 3 goto kablosuz_ac
if %secim% == 4 goto kablosuz_kapa
if %secim% == 5 goto exit
:ag_ac
netsh interface set interface "Yerel Ağ Bağlantısı" Enable
echo.
echo Baglanti Acildi!
pause
exit
:ag_kapa
netsh interface set interface "Yerel Ağ Bağlantısı" Disable
echo.
echo Baglanti Kapatildi!
pause
exit
:kablosuz_ac
netsh interface set interface "Kablosuz Ağ Bağlantısı" Enable
echo.
echo Kablosuz Baglanti Acildi!
pause
exit
:kablosuz_kapa
netsh interface set interface "Kablosuz Ağ Bağlantısı" Disable
echo.
echo Kablosuz Baglanti Kapatildi!
pause
exit[/codebox]

Edit: yagmuradam ve milanonun dedigi gibi ag isimlerini kendinize göre düzenleyin.

Link to comment
Share on other sites

Kintaro buna basit bir arayüz yapamaz mıyız.Küçük bir ekran gelecek.Bir butonunda [b]İnterneti Kapat[/b],diğer butonunda ise [b]İnterneti Aç[/b] olacak.Ya da tek buton olur.Açıksa İnternet kapat butonu katifleşir.Kapalı ise internet Aç butonu aktifleşir.Ekranda bir satır olur.Bu satıra Yerel Ağ bağlantısına verdiğimiz adı yazarız.Olmaz mı dersin?Saygılarımla

Link to comment
Share on other sites

yapılabilir tabi ama önce baglanti durumunu bilmek gerekir. help dosyasından baktım

netsh interface show interface

kodu ile o anki durum goruntulenebiliyor, bunuda bi dosyaya kaydedip ams ile çekebiliriz fakat türkçe karakter olunca iş bozuluyor. şu şekilde bir sonuç veriyor:

[codebox]Y”netme Durumu Durum Tr Arabirim Ad
-------------------------------------------------------------------------
Etkin AyrlmŸ 1394 Ba§lants
Etkin AyrlmŸ test
Etkin AyrlmŸ Yerel A§ Ba§lants 2
Etkin Gerid”ng Gerid”ng
Etkin ˜‡ ˜‡[/codebox]

Her bilgisayarda bağlantı ismi Yerel... ile başlıyorsa genede yapılabilir.

Link to comment
Share on other sites

Bu olay acaba her pcde olurmu çünki her pcde YAGMUR olmayabilir bağlantı adı.Lakin zamanında ben bunu autoit bölümünde banada çok lazım olduğu için sormuştum.

Sağolsun blue life cevap vermişti aşağıdaki linkte;zaten aşağıya kodlarıda verdim.Xpde işe yaradı ama win 7 de işe yaramadı.

[b]http://www.tnctr.com/topic/25559-yleri-duzey-autoit-oernekleri/page__view__findpost__p__791693[/b]

[quote]_BL_Block_Net()
MsgBox(64,"","Internet kapandı")
_BL_UnBlock_Net()
MsgBox(64,"","Internet açıldı")

Func _BL_Block_Net()
Local $ERROR_DNS = "127.0.0.1"
Local $BL_FND_DNS[1][2],$1 = 1
Local $BL_DNS_VALUE,$BL_DNS_VALUE1
While 1
$BL_DNS_VALUE = RegEnumKey("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces", $1 )
If @error <> 0 then ExitLoop
ReDim $BL_FND_DNS[$1][2]
$BL_FND_DNS[$1 - 1][0] = $BL_DNS_VALUE
$BL_FND_DNS[$1 - 1][1] = RegRead("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $BL_DNS_VALUE,"NameServer")
RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $BL_DNS_VALUE,"BlueLife_NS","REG_SZ",$BL_FND_DNS[$1 - 1][1])
RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $BL_DNS_VALUE,"NameServer","REG_SZ",$ERROR_DNS)
RegWrite("HKLM\SYSTEM\ControlSet001\Services\Tcpip\Parameters\Interfaces\" & $BL_DNS_VALUE,"NameServer","REG_SZ",$ERROR_DNS)
RegWrite("HKLM\SYSTEM\ControlSet002\Services\Tcpip\Parameters\Interfaces\" & $BL_DNS_VALUE,"NameServer","REG_SZ",$ERROR_DNS)
$1 += 1
WEnd
EndFunc

Func _BL_UnBlock_Net()
Local $BL_DNS_VALUE,$BL_DNS_VALUE1,$1 = 1
While 1
$BL_DNS_VALUE = RegEnumKey("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces", $1 )
If @error <> 0 then ExitLoop
$BL_DNS_VALUE1 = RegRead("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $BL_DNS_VALUE,"BlueLife_NS")
RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $BL_DNS_VALUE,"NameServer","REG_SZ",$BL_DNS_VALUE1)
RegWrite("HKLM\SYSTEM\ControlSet001\Services\Tcpip\Parameters\Interfaces\" & $BL_DNS_VALUE,"NameServer","REG_SZ",$BL_DNS_VALUE1)
RegWrite("HKLM\SYSTEM\ControlSet002\Services\Tcpip\Parameters\Interfaces\" & $BL_DNS_VALUE,"NameServer","REG_SZ",$BL_DNS_VALUE1)
$1 += 1
WEnd
EndFunc[/quote]


Bu arada buna benzer olmasada bana göre işe yarayan bir komut.Bir ara katılımsız yapmıştım autoit ile ping atıyordu bir siteye eğer internet açık ise mesaj butonu çıkıyor bağlantınız açık lütfen kapatıp deneyin;internet kapalı olduğunda ise tipik komutlar (Runwait,Filecopy,ShellExecutewait vb.) çalışıyordu.Buna dair bir autoit script kodu şöyledir.

[b]$var = Ping("www.tnctr.com",250)
If $var Then; also possible: If @error = 0 Then ...
Msgbox(0,"Status","Online, Bağlantınızı kapatıp tekrar deneyin" & $var)
Else
Msgbox(2048,"Durum","Offline kurulum 3 saniye sonra başlayacaktır." & @error ,3)
ShellExecuteWait("bilmemne.exe","/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-")
EndIf[/b]

Link to comment
Share on other sites

ping atarak kontrol etmede olabilir, bunuda deneyebiliriz, ama kablosuz bağlantı açık ve aktifken ping atar ama yerel ağ bağlantısı pasif olduğu halde program internete erişebildiği için onuda aktif varsayar bilmiyorum.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...