-1

I have the following code to run SSMS from python script (because I want it to run automatically before I get to work):

import os
run_line = ' '.join(['ssms.exe', '-S', server_name, '-U', user_name, '-P', my_password])
os.system('cmd /c ' + run_line)

Where server_name user_name my_password hold the arguments for the ssms.exe running. It works and starts the SSMS using the user and password, but the script doesn't terminate until I close the SSMS, or shut it down manually. How can I run the program and end the script automatically without closing the SSMS?

Aryerez
  • 3,417
  • 2
  • 9
  • 17
  • Take also a look at this: [How to execute a program or call a system command?](https://stackoverflow.com/q/89228) – aschipfl Jul 12 '21 at 12:41

1 Answers1

-2

I am not shure if this helps you but I use regulary

import sys
sys.exit()

sys.exit() will stop your programm from running

  • It doesn't help, as the script stays in the `os.system` line, and doesn't run anything after it. – Aryerez Jul 12 '21 at 06:06