Mysql Command line Parameter passing to sql file In windows mysql(5.7 version),
I want to run mysql commmand using command line for .sql file as input .
Also i was to pass some variable whose value should get used in .sql file.
somehow I am not able to achieve it.

mysql -u root -p xyz  -e "set @tmp='abc'; source d:/v_test1.sql"


Here I want to file v_test1.sql having mysql code and also variable @tmp being used in v_test1.sql.

But getting error:


  MySQL Error: Unknown column '@tmp' in 'field list'


I think issue might be because of version.
Please suggest some solution.
Try something like

echo set @tmp='abc'; &gt; %temp%\temp.sql
copy /b %temp%\temp.sql+d:/v_test1.sql
mysql -u root -p xyz &lt; %temp%\temp.sql
del %temp%\temp.sql