-
January 4th, 2011, 03:07 PM
#1
win batch file that uploads mysql data
i wasn't sure where to put this thread so please redirect me if im in the wrong forum.
i have a batch file that uploads a data.sql script to a mysql server and its working fine, i have this command:
Code:
mysql -u [username] -p[pass] -h [host] [db_name] < data.sql
this works fine but i want add the ability to write to a log whenever this batch file executes successfully or if there is an error
basically i want to be able to do something like this:
Code:
mysql -u [username] -p[pass] -h [host] [db_name] < data.sql
*sudocode*
if mysql command ok
echo "command executed successfully >> log.txt
else if mysql command returned error
echo "there was an error the command did not executed" >> log txt
so my question boils down to, am I taking the right approach? and if so how can i read or interpret the responses from the shell within a batch file? is that possible or should I consider more powerful languages for this type of scripts like c++ or java?
thanks.
-
January 4th, 2011, 03:55 PM
#2
Re: win batch file that uploads mysql data
Take a look at POWERSHELL 2.0. It's FREE, and uses .Net to replace the old DOS BATCH FILE structure. You can make a progress bar with a few ****'s
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|