#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>
If $CMDLINE[0] <> 0 Then
If $CMDLINE[1] = "-restart" Then
_SendMessage(WinGetHandle("Test"), $WM_CLOSE)
EndIf
EndIf
GUICreate("Test", 250, 250, -1, -1)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd