This is the function that returns the result from cmd, initially i connect to the network wait then i make a call to the above _GetDOSOutput($sCommand) function i want to wait 1 period of time netsh wlan connect name="name" actually but after starting to execute the netsh wlan show interfaces command i tried adding a timeout command it seems to have ignored the timeout command?
#include <WindowsConstants.au3>
#include <Constants.au3>
Func _GetDOSOutput($sCommand)
Run('"' & @ComSpec & '" /c ' & $sCommand, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
Local $sOutput = ''
Local $iPID = Run('"' & @ComSpec & '" /c ' & $sCommand, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
While 1
$sOutput &= StdoutRead($iPID, False, False)
If @error Then
ExitLoop
EndIf
Sleep(10)
WEnd
Return $sOutput
EndFunc
Local $sCommand= 'netsh wlan delete profile name="wait" & netsh wlan connect name="name" interface="Wi-fi" & netsh wlan show interfaces'
MsgBox(0,0,_GetDOSOutput($sCommand))