CrazyTasty Posted May 18, 2011 Share Posted May 18, 2011 I have a script that does an uninstall of an app and then an install of the same app. Later in the script I run a command line argument through a cmd.exe window that restores a MySql database. When running this in the editor everything works fine; however, it I generate an executable and run it, it seems to run twice. Once it reaches the command line part, the entire script starts to run again. I did notice when running in the editor, that it opens a new blank window in the editor. Here's a snippet of the command line piece. $dbVar = 'C:\WINDOWS\system32\cmd.exe /C "C:\MySQL Server 5.1\bin\mysql.exe" -u root -p coresearch < C:\Temp\dump.sql' Run($dbVar) Any help is appreciated... Link to comment Share on other sites More sharing options...
dufran3 Posted May 18, 2011 Share Posted May 18, 2011 (edited) Maybe this will help:From help file - To run DOS (console) commands, try Run(@ComSpec & " /c " & 'commandName', "", @SW_HIDE) ; don't forget " " before "/c" Edited May 18, 2011 by dufran3 Link to comment Share on other sites More sharing options...
hannes08 Posted May 18, 2011 Share Posted May 18, 2011 Hi CrazyTasty, maybe you want to show us more of your script, as from the Run Command we cannot tell you what goes wrong. Except your script is called mysql.exe and is located in "C:\MySQL Server 5.1\bin\" ... Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
CrazyTasty Posted May 20, 2011 Author Share Posted May 20, 2011 Here's the simple script that does the uninstall, install and database load. I know having the Sleep function is a bad idea, but I've tried other things that didn't work how I expected them to work. Keep in mind I'm a newbie to this tool. When I run this through a compiled executable, and when it gets to the bottom piece (where the database is loaded through the command line) the entire script executes again or some weird mouse clicks occur outside of the process (stuff is clicked in a different app that might be opened) expandcollapse popup$unVar = @ProgramFilesDir & "\CoResearch\unins000.exe" Run($unVar) Sleep(2000) WinWaitActive("CoResearch Uninstall") Send("!Y") Send("{ENTER}") Sleep(3000) WinWaitActive("CoResearch Uninstall") Send("!O") Send("{ENTER}") $inVar = "C:\Temp\setup.exe" Run($inVar) Sleep(2000) WinWaitActive("Setup - CoResearch") Send("!N") Send("{ENTER}") Sleep(2000) ;WinWaitActive("Setup - CoResearch") Send("!N") Send("{ENTER}") Sleep(2000) ;WinWaitActive("Setup - CoResearch") Send("!I") Send("{ENTER}") Sleep(5000) ;WinWaitActive("Setup - CoResearch") Send("!F") Send("{ENTER}") ; Do the database here RunWait(@ComSpec & " /c " & '"C:\MySQL Server 5.1\bin\mysql.exe" -u root -pr00t coresearch < C:\Temp\dump.sql', "",@SW_HIDE) MsgBox(0,"AutoIt", "Upgrade Complete...") Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now