ipconfig

  • moin,

    ich bin ein ziemlicher neuling und habe da ein kleines Problem

    wenn ich ein skript schreibe wo "ipconfig /all" abgerufen wird öffnet sich das DOS Fenster. Ich hätte es aber gern in der Gui wo ich den Befehl absetze. Wie würde das dann aussehen?

  • moin,

    ich bin ein ziemlicher neuling und habe da ein kleines Problem

    wenn ich ein skript schreibe wo "ipconfig /all" abgerufen wird öffnet sich das DOS Fenster. Ich hätte es aber gern in der Gui wo ich den Befehl absetze. Wie würde das dann aussehen?

    hi, schau mal in der autoit hilfe nach "StdoutRead". die console kannst du mit @SW_HIDE im hintergrund laufen lassen(nicht sichtbar)

  • ja das ist schon mal nicht schlecht... :P

    geht das auch in der direkten Gui..... wie im Datei Anhang ?(

    • Offizieller Beitrag
    [autoit]

    Global $re = _getDOSOutput('ipconfig /all')
    MsgBox(64, 'IPCONFIG / ALL', StringStripWS($re, 7), 20)
    Func _getDOSOutput($command)
    Local $text = '', $Pid = Run('"' & @ComSpec & '" /c ' & $command, '', @SW_HIDE, 2 + 4)
    While 1
    $text &= StdoutRead($Pid, False, False)
    If @error Then ExitLoop
    Sleep(10)
    WEnd
    Return $text
    EndFunc ;==>_getDOSOutput

    [/autoit]

    Mega

  • hmm, ich habe jetzt folgendes Probiert,
    es soll aber in keinen Extrafenster erscheinen sondern direkt in diesem also in der Group1


    [autoit]


    #include <GUIConstants.au3>
    #Region ### START Koda GUI section ### Form=C:\AForm1.kxf
    $Form1 = GUICreate("helfer", 364, 252, 193, 115)
    $Tab1 = GUICtrlCreateTab(0, 0, 361, 249)
    $TabSheet1 = GUICtrlCreateTabItem("IP-Grundlagen")
    $Button1 = GUICtrlCreateButton("IPconfig / all", 16, 40, 97, 17, 0)
    $Button2 = GUICtrlCreateButton("IPconfig / release", 16, 64, 97, 17, 0)
    $Button3 = GUICtrlCreateButton("IPconfig / renew", 17, 91, 97, 17, 0)
    $Button4 = GUICtrlCreateButton("net use", 120, 40, 97, 17, 0)
    $Group1 = GUICtrlCreateGroup("Group1", 32, 72, 257, 145)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $TabSheet2 = GUICtrlCreateTabItem("Netzwerk ")
    $TabSheet3 = GUICtrlCreateTabItem("AD User")
    $TabSheet4 = GUICtrlCreateTabItem("IP-Scanner")
    $Button100 = GUICtrlCreateButton("ipscanner", 20, 40, 97, 17, 0)
    GUICtrlCreateTabItem("")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    ;beginn Tab 1
    Case $button1
    Global $re = _getDOSOutput('ipconfig /all')
    MsgBox(64, 'IPCONFIG / ALL', StringStripWS($re, 7), 20)
    Func _getDOSOutput($command)
    Local $text = '', $Pid = Run('"' & @ComSpec & '" /c ' & $command, '', @SW_HIDE, 2 + 4)
    While 1
    $text &= StdoutRead($Pid, False, False)
    If @error Then ExitLoop
    Sleep(10)
    WEnd
    Return $text
    EndFunc ;==>_getDOSOutput

    [/autoit][autoit][/autoit][autoit]

    Case $button2
    Run("cmd")
    Send("{TAB} ipconfig /release")
    Send("{ENTER}")
    Case $button3
    Run("cmd")
    Send("{TAB} ipconfig /renew")
    Send("{ENTER}")
    Case $button4
    Run("cmd")
    Send("{TAB} net use")
    Send("{ENTER}")
    ;ende Tab 1
    Case $button100
    Dim $GOOEY = GUICreate("IP-Scanner",350,300)
    Dim $edit = GUICtrlCreateEdit("",10,10,300,180)
    guisetstate()
    $i=1
    EndSwitch
    WEnd

    [/autoit]
    • Offizieller Beitrag

    Hi,

    kleine Hilfe den Rest schaffst du selbst.

    Spoiler anzeigen
    [autoit]

    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=C:\AForm1.kxf
    $Form1 = GUICreate("helfer", 364, 252, 193, 115)
    $Tab1 = GUICtrlCreateTab(0, 0, 361, 249)
    $TabSheet1 = GUICtrlCreateTabItem("IP-Grundlagen")
    $Button1 = GUICtrlCreateButton("IPconfig / all", 16, 40, 97, 17, 0)
    $Button2 = GUICtrlCreateButton("IPconfig / release", 16, 64, 97, 17, 0)
    $Button3 = GUICtrlCreateButton("IPconfig / renew", 17, 91, 97, 17, 0)
    $Button4 = GUICtrlCreateButton("net use", 120, 40, 97, 17, 0)
    $edit = GUICtrlCreateEdit("", 32, 122, 257, 85,$ES_AUTOVSCROLL + $WS_VSCROLL)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $TabSheet2 = GUICtrlCreateTabItem("Netzwerk ")
    $TabSheet3 = GUICtrlCreateTabItem("AD User")
    $TabSheet4 = GUICtrlCreateTabItem("IP-Scanner")
    $Button100 = GUICtrlCreateButton("ipscanner", 20, 40, 97, 17, 0)
    GUICtrlCreateTabItem("")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    ;beginn Tab 1
    Case $Button1
    GUICtrlSetData($edit, StringStripWS(_getDOSOutput('ipconfig /all'),7))
    ConsoleWrite(StringStripWS(_getDOSOutput('ipconfig /all'),7) & @CRLF)
    Case $Button2
    Run("cmd")
    Send("{TAB} ipconfig /release")
    Send("{ENTER}")
    Case $Button3
    Run("cmd")
    Send("{TAB} ipconfig /renew")
    Send("{ENTER}")
    Case $Button4
    Run("cmd")
    Send("{TAB} net use")
    Send("{ENTER}")
    ;ende Tab 1
    Case $Button100
    Dim $GOOEY = GUICreate("IP-Scanner", 350, 300)
    Dim $edit = GUICtrlCreateEdit("", 10, 10, 300, 180)
    GUISetState()
    $i = 1
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _getDOSOutput($command)
    Local $text = '', $Pid = Run('"' & @ComSpec & '" /c ' & $command, '', @SW_HIDE, 2 + 4)
    While 1
    $text &= StdoutRead($Pid, False, False)
    If @error Then ExitLoop
    Sleep(10)
    WEnd
    Return $text
    EndFunc ;==>_getDOSOutput

    [/autoit]

    Mega

  • soweit so gut :P

    Ich habe nur noch ein kleines Problem, die ausgegebenen Werte sind ziemlich durcheinander und mit ........ getrennt kann man das Irgendwie trennen?

    Beispiel der Ausgabe:Knotentyp . . . . . . . . . . . . : HybridIP-Routing aktiviert . . . . . . : NeinWINS-Proxy aktiviert . . . . . . : NeinDNS-Suffixsuchliste . . . . . . . :


    Spoiler anzeigen
    [autoit]


    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=c:\end.kxf
    $Form1 = GUICreate("helfer", 629, 529, 205, 129)
    $Tab1 = GUICtrlCreateTab(0, 0, 625, 521)
    $TabSheet1 = GUICtrlCreateTabItem("Netzwerk-Tool")
    $Button2 = GUICtrlCreateButton("registerdns", 393, 51, 65, 17, 0)
    $Button1 = GUICtrlCreateButton("flushdns", 321, 51, 65, 17, 0)
    $Button3 = GUICtrlCreateButton("displaydns", 241, 51, 65, 17, 0)
    $Button4 = GUICtrlCreateButton("renew", 161, 51, 65, 17, 0)
    $Button5 = GUICtrlCreateButton("release", 89, 51, 65, 17, 0)
    $Button6 = GUICtrlCreateButton("all", 17, 51, 65, 17, 0)
    $Button10 = GUICtrlCreateButton("-e", 16, 105, 65, 17, 0)
    $Button8 = GUICtrlCreateButton("-r", 88, 105, 65, 17, 0)
    $Button7 = GUICtrlCreateButton("-n", 160, 105, 65, 17, 0)
    $Button9 = GUICtrlCreateButton("-a", 240, 105, 65, 17, 0)
    $Button11 = GUICtrlCreateButton("-a", 19, 165, 65, 17, 0)
    $Button12 = GUICtrlCreateButton("-d", 91, 165, 65, 17, 0)
    $Button13 = GUICtrlCreateButton("nslookup", 206, 165, 65, 17, 0)
    $Button14 = GUICtrlCreateButton("net time", 278, 165, 65, 17, 0)
    $Button15 = GUICtrlCreateButton("net view", 350, 165, 65, 17, 0)
    $Button16 = GUICtrlCreateButton("host name", 422, 165, 65, 17, 0)
    $Button17 = GUICtrlCreateButton("net share", 494, 165, 65, 17, 0)
    $Label1 = GUICtrlCreateLabel("ipconfig", 16, 32, 593, 17)
    GUICtrlSetBkColor(-1, 0xB9D1EA)
    $Label2 = GUICtrlCreateLabel("netstat", 14, 86, 596, 17)
    GUICtrlSetBkColor(-1, 0xB9D1EA)
    $Label3 = GUICtrlCreateLabel("arp und sonnstige", 17, 145, 592, 17)
    GUICtrlSetBkColor(-1, 0xB9D1EA)
    $edit = GUICtrlCreateEdit("", 12, 193, 604, 317,$ES_AUTOVSCROLL + $WS_VSCROLL)
    GUICtrlSetFont(-1, 8, 300, 0, "Arial")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $TabSheet4 = GUICtrlCreateTabItem("ip-scanner")
    GUICtrlCreateTabItem("")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    ;beginn Tab 1
    Case $Button1
    GUICtrlSetData($edit, StringStripWS(_getDOSOutput('ipconfig /flushdns'),7))
    ConsoleWrite(StringStripWS(_getDOSOutput('ipconfig /flushdns'),7) & @CRLF)
    Case $Button2
    GUICtrlSetData($edit, StringStripWS(_getDOSOutput('ipconfig /registerdns'),7))
    ConsoleWrite(StringStripWS(_getDOSOutput('ipconfig /registerdns'),7) & @CRLF)
    Case $Button3
    GUICtrlSetData($edit, StringStripWS(_getDOSOutput('ipconfig /displaydns'),7))
    ConsoleWrite(StringStripWS(_getDOSOutput('ipconfig /displaydns'),7) & @CRLF)
    Case $Button4
    GUICtrlSetData($edit, StringStripWS(_getDOSOutput('ipconfig /renew'),7))
    ConsoleWrite(StringStripWS(_getDOSOutput('ipconfig /renew'),7) & @CRLF)
    Case $Button5
    GUICtrlSetData($edit, StringStripWS(_getDOSOutput('ipconfig /release'),7))
    ConsoleWrite(StringStripWS(_getDOSOutput('ipconfig /release'),7) & @CRLF)
    Case $Button6
    GUICtrlSetData($edit, StringStripWS(_getDOSOutput('ipconfig /all'),7))
    ConsoleWrite(StringStripWS(_getDOSOutput('ipconfig /all'),7) & @CRLF)
    Case $Button7
    GUICtrlSetData($edit, StringStripWS(_getDOSOutput('netstat -n'),7))
    ConsoleWrite(StringStripWS(_getDOSOutput('netstat -n'),7) & @CRLF)
    Case $Button8
    GUICtrlSetData($edit, StringStripWS(_getDOSOutput('netstat -r'),7))
    ConsoleWrite(StringStripWS(_getDOSOutput('netstat -r'),7) & @CRLF)
    Case $Button9
    GUICtrlSetData($edit, StringStripWS(_getDOSOutput('netstat -a'),7))
    ConsoleWrite(StringStripWS(_getDOSOutput('netstat -a'),7) & @CRLF)
    Case $Button10
    GUICtrlSetData($edit, StringStripWS(_getDOSOutput('netstat -e'),7))
    ConsoleWrite(StringStripWS(_getDOSOutput('netstat -e'),7) & @CRLF)
    Case $Button11
    GUICtrlSetData($edit, StringStripWS(_getDOSOutput('arp -a'),7))
    ConsoleWrite(StringStripWS(_getDOSOutput('arp -a'),7) & @CRLF)
    Case $Button12
    GUICtrlSetData($edit, StringStripWS(_getDOSOutput('arp -d'),7))
    ConsoleWrite(StringStripWS(_getDOSOutput('arp -d'),7) & @CRLF)
    Case $Button13
    GUICtrlSetData($edit, StringStripWS(_getDOSOutput('nslookup'),7))
    ConsoleWrite(StringStripWS(_getDOSOutput('nslookup'),7) & @CRLF)
    Case $Button14
    GUICtrlSetData($edit, StringStripWS(_getDOSOutput('net time'),7))
    ConsoleWrite(StringStripWS(_getDOSOutput('net time'),7) & @CRLF)
    Case $Button15
    GUICtrlSetData($edit, StringStripWS(_getDOSOutput('net view'),7))
    ConsoleWrite(StringStripWS(_getDOSOutput('net view'),7) & @CRLF)
    Case $Button16
    GUICtrlSetData($edit, StringStripWS(_getDOSOutput('host name'),7))
    ConsoleWrite(StringStripWS(_getDOSOutput('host name'),7) & @CRLF)
    Case $Button17
    GUICtrlSetData($edit, StringStripWS(_getDOSOutput('net share'),7))
    ConsoleWrite(StringStripWS(_getDOSOutput('net share'),7) & @CRLF)
    ;ende Tab 1

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd
    Func _getDOSOutput($command)
    Local $text = '', $Pid = Run('"' & @ComSpec & '" /c ' & $command, '', @SW_HIDE, 2 + 4)
    While 1
    $text &= StdoutRead($Pid, False, False)
    If @error Then ExitLoop
    Sleep(10)
    WEnd
    Return $text
    EndFunc ;==>_getDOSOutput

    [/autoit]
    • Offizieller Beitrag

    Hi,

    versuch mal so:

    Spoiler anzeigen
    [autoit]

    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=c:\end.kxf
    $Form1 = GUICreate("helfer", 629, 529, 205, 129)
    $Tab1 = GUICtrlCreateTab(0, 0, 625, 521)
    $TabSheet1 = GUICtrlCreateTabItem("Netzwerk-Tool")
    $Button2 = GUICtrlCreateButton("registerdns", 393, 51, 65, 17, 0)
    $Button1 = GUICtrlCreateButton("flushdns", 321, 51, 65, 17, 0)
    $Button3 = GUICtrlCreateButton("displaydns", 241, 51, 65, 17, 0)
    $Button4 = GUICtrlCreateButton("renew", 161, 51, 65, 17, 0)
    $Button5 = GUICtrlCreateButton("release", 89, 51, 65, 17, 0)
    $Button6 = GUICtrlCreateButton("all", 17, 51, 65, 17, 0)
    $Button10 = GUICtrlCreateButton("-e", 16, 105, 65, 17, 0)
    $Button8 = GUICtrlCreateButton("-r", 88, 105, 65, 17, 0)
    $Button7 = GUICtrlCreateButton("-n", 160, 105, 65, 17, 0)
    $Button9 = GUICtrlCreateButton("-a", 240, 105, 65, 17, 0)
    $Button11 = GUICtrlCreateButton("-a", 19, 165, 65, 17, 0)
    $Button12 = GUICtrlCreateButton("-d", 91, 165, 65, 17, 0)
    $Button13 = GUICtrlCreateButton("nslookup", 206, 165, 65, 17, 0)
    $Button14 = GUICtrlCreateButton("net time", 278, 165, 65, 17, 0)
    $Button15 = GUICtrlCreateButton("net view", 350, 165, 65, 17, 0)
    $Button16 = GUICtrlCreateButton("host name", 422, 165, 65, 17, 0)
    $Button17 = GUICtrlCreateButton("net share", 494, 165, 65, 17, 0)
    $Label1 = GUICtrlCreateLabel("ipconfig", 16, 32, 593, 17)
    GUICtrlSetBkColor(-1, 0xB9D1EA)
    $Label2 = GUICtrlCreateLabel("netstat", 14, 86, 596, 17)
    GUICtrlSetBkColor(-1, 0xB9D1EA)
    $Label3 = GUICtrlCreateLabel("arp und sonnstige", 17, 145, 592, 17)
    GUICtrlSetBkColor(-1, 0xB9D1EA)
    $edit = GUICtrlCreateEdit("", 12, 193, 604, 317, $ES_AUTOVSCROLL + $WS_VSCROLL+ $ES_WANTRETURN +$ES_MULTILINE)
    GUICtrlSetFont(-1, 8, 300, 0, "Arial")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $TabSheet4 = GUICtrlCreateTabItem("ip-scanner")
    GUICtrlCreateTabItem("")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    ;beginn Tab 1
    Case $Button1
    GUICtrlSetData($edit, _getDOSOutput('ipconfig /flushdns'))
    ;~ ConsoleWrite(_getDOSOutput('ipconfig /flushdns') & @CRLF)
    Case $Button2
    GUICtrlSetData($edit, _getDOSOutput('ipconfig /registerdns'))
    ;~ ConsoleWrite(_getDOSOutput('ipconfig /registerdns') & @CRLF)
    Case $Button3
    GUICtrlSetData($edit, _getDOSOutput('ipconfig /displaydns'))
    ;~ ConsoleWrite(_getDOSOutput('ipconfig /displaydns') & @CRLF)
    Case $Button4
    GUICtrlSetData($edit, _getDOSOutput('ipconfig /renew'))
    ;~ ConsoleWrite(_getDOSOutput('ipconfig /renew') & @CRLF)
    Case $Button5
    GUICtrlSetData($edit, _getDOSOutput('ipconfig /release'))
    ;~ ConsoleWrite(_getDOSOutput('ipconfig /release') & @CRLF)
    Case $Button6
    GUICtrlSetData($edit, _getDOSOutput('ipconfig /all'))
    ConsoleWrite(_getDOSOutput('ipconfig /all'))
    Case $Button7
    GUICtrlSetData($edit, _getDOSOutput('netstat -n'))
    ;~ ConsoleWrite(_getDOSOutput('netstat -n') & @CRLF)
    Case $Button8
    GUICtrlSetData($edit, _getDOSOutput('netstat -r'))
    ;~ ConsoleWrite(_getDOSOutput('netstat -r') & @CRLF)
    Case $Button9
    GUICtrlSetData($edit, _getDOSOutput('netstat -a'))
    ;~ ConsoleWrite(_getDOSOutput('netstat -a') & @CRLF)
    Case $Button10
    GUICtrlSetData($edit, _getDOSOutput('netstat -e'))
    ;~ ConsoleWrite(_getDOSOutput('netstat -e') & @CRLF)
    Case $Button11
    GUICtrlSetData($edit, _getDOSOutput('arp -a'))
    ;~ ConsoleWrite(_getDOSOutput('arp -a') & @CRLF)
    Case $Button12
    GUICtrlSetData($edit, _getDOSOutput('arp -d'))
    ;~ ConsoleWrite(_getDOSOutput('arp -d') & @CRLF)
    Case $Button13
    GUICtrlSetData($edit, _getDOSOutput('nslookup'))
    ;~ ConsoleWrite(_getDOSOutput('nslookup') & @CRLF)
    Case $Button14
    GUICtrlSetData($edit, _getDOSOutput('net time'))
    ;~ ConsoleWrite(_getDOSOutput('net time') & @CRLF)
    Case $Button15
    GUICtrlSetData($edit, _getDOSOutput('net view'))
    ;~ ConsoleWrite(_getDOSOutput('net view') & @CRLF)
    Case $Button16
    GUICtrlSetData($edit, _getDOSOutput('host name'))
    ;~ ConsoleWrite(_getDOSOutput('host name') & @CRLF)
    Case $Button17
    GUICtrlSetData($edit, _getDOSOutput('net share'))
    ;~ ConsoleWrite(_getDOSOutput('net share') & @CRLF)
    ;ende Tab 1

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd
    Func _getDOSOutput($command)
    Local $text = '', $Pid = Run('"' & @ComSpec & '" /c ' & $command, '', @SW_HIDE, 2 + 4)
    While 1
    $text &= StdoutRead($Pid, False, False) & @CR
    If @error Then ExitLoop
    Sleep(10)
    WEnd
    ;~ Return StringReplace(StringReplace(StringStripWS($text, 7), @CR, @CRLF), @LF, @CRLF)
    Return StringStripWS($text, 3)
    EndFunc ;==>_getDOSOutput

    [/autoit]

    Mega