I have created an SQL file for my SQL server. When I double-click on that, Microsoft SQL server Management Studio 18 is opened, username and password are asked, the query is opened and I can launch it.

I would like to do this automatically. Is there a commandline tool for this? (I already checked, I don't have mssql-cli on my computer)


I suggest you use sqlcmd it is part of SQL Server so hopefully you will already have it installed.

See this other answer regarding which part of the SQL Server installation it is included in.
In summary it is included as part of Management Tools - Basic, but you can also install it separately if required.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.