I want to run bat file in mysql prompt automatically in all computers without setting environment variable path.
I am using Xampp server,but some of my friends using Wampp and MysqlServer. However I want to run my sql commands by running a .bat file.So I want to navigate to the MySql> prompt first.
I tried following CMD command to find the service,
tasklist /svc >mysqld.exe
but I can't navigate to mysql>
Help me if someone has any solution. Thanks.
On the Windows desktop, right-click the My Computer icon, and select Properties. Next select the Advanced tab from the System Properties menu that appears, and click the Environment Variables button. Under System Variables, select Path, and then click the Edit button. The Edit System Variable dialogue should appear.
This would do the trick:
for /f "tokens=3 skip=3" %a in ('tasklist /svc /fi "imagename eq mysqld.exe"') do @cmd /c sc qc %a ^| findstr PATH
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With