Link to home
Start Free TrialLog in
Avatar of Justin2135
Justin2135Flag for United States of America

asked on

AutoIT help with running .bat files?

I am very new to AutoIT but it looks like an interesting tool to use so I thought I would give it a try.  I am wanting to create a menu with 4 buttons that when clicked will just point to 4 different bat files depending on which button is clicked.  The bat files should be able to finish the installs for what I am wanting so I'm pretty sure that's all I need from AutoIT is just to create the menu and the buttons.  How do you point the button to a specific bat file.
Avatar of matrixnz
matrixnz

Run(@ComSpec & ' /C <Batch File Name>', '', @SW_HIDE)
More complete example
GUICreate('My App', 400, 20)
$Button1 = GUICtrlCreateButton('Button 1', 0, 0, 100, 20)
$Button2 = GUICtrlCreateButton('Button 2', 100, 0, 100, 20)
$Button3 = GUICtrlCreateButton('Button 3', 200, 0, 100, 20)
$Button4 = GUICtrlCreateButton('Button 4', 300, 0, 100, 20)
GUISetState()

While 1
	$msg = GUIGetMsg()
	Select
		Case $msg = $GUI_EVENT_CLOSE
			ExitLoop
		Case $msg = $Button1
			Run(@ComSpec & ' /C <Batch File 1 Name>.bat', '', @SW_HIDE)
		Case $msg = $Button2
			Run(@ComSpec & ' /C <Batch File 2 Name>.bat', '', @SW_HIDE)
		Case $msg = $Button3
			Run(@ComSpec & ' /C <Batch File 3 Name>.bat', '', @SW_HIDE)
		Case $msg = $Button4
			Run(@ComSpec & ' /C <Batch File 4 Name>.bat', '', @SW_HIDE)
	EndSelect
WEnd

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of matrixnz
matrixnz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If I were you I'd convert the bat files to AutoIT as wel. Take a look a the AutoIT help file, it's very elaborate..