还有点小问题,仅供参考,有时候会出现乱码#include <Constants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("test", 251, 175, -1, -1)
$ButtonOk = GUICtrlCreateButton("确定", 78, 144, 75, 25, $BS_NOTIFY)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 233, 129)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $ButtonOk
Rundos()
EndSwitch
WEnd
Func Rundos()
Local $foo = Run(@ComSpec & " /c net user", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
Local $line
Local $lines=""
While 1
$line = StdoutRead($foo)
$lines=$line&$lines
If @error Then ExitLoop
If $line<>"" Then GUICtrlSetData($Edit1, $lines)
Wend
EndFunc
|