Passing argument to a .bat file

September 7, 2010 at 03:29:02
Specs: Windows XP

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
%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.sqlare 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:

%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.

See More: Passing argument to a .bat file

Report •

September 8, 2010 at 12:44:30
importdata.bat dumpfile-20100609-0552PM.sql

Presumably, you'd do something like this:

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

Report •
Related Solutions

Ask Question