tags:

views:

18

answers:

1

Experts,

I have 2 .bat scripts called exportdata.bat and other is importdata.bat. Both are used to take backup of the data. in exportdata.bat i am executing following command

:home_defined
%MY_HOME%\database\bin\mysqldump -u root -p mydata>dumpfile.sql 

and later i am inserting date-timestamp and then renaming it to dumpfile-20100609-0551PM.sql.

Each time i execute exportdata.bat, number of times new files with new timestamps generate. After 3 executions, dumpfile-20100609-0551PM.sql, dumpfile-20100609-0552PM.sql and dumpfile-20100609-0551PM.sql are generated. Now in importdata.bat, i want to pass an argument of one of these timestamp files like following. This is user defined.

importdata.bat dumpfile-20100609-0552PM.sql.

Right now in importdata.bat i am executing following command just like exportdata.bat:

:home_defined
%MY_HOME%\database\bin\mysql -u root -p mydata<dumpfile.sql 

How should I do it? How should i set the parameter/arguments? Do i need to use dir/?, dir *.sql commands? Please advise/suggest. Thank you in advance.

A: 

This is pretty simple:

%MY_HOME%\database\bin\mysql -u root -p mydata < %1

%1 gets replaced with the first parameter. %2 would be the second, etc.

Aaron Digulla