Guest User

Untitled

a guest
Jul 29th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. How to create 3 instances of command prompt in Windows and pass commands to each prompt in parallel using python
  2. def Plink():
  3. name = multiprocessing.current_process().name
  4. proc = subprocess.Popen("C:\Windows\System32\cmd.exe")
  5.  
  6. if __name__ == '__main__':
  7. Plink_1 = multiprocessing.Process(name='Plink 1', target=Plink)
  8. Plink_2 = multiprocessing.Process(name='Plink 2', target=Plink)
  9. Plink_3 = multiprocessing.Process(name='Plink 3', target=Plink)
  10.  
  11. Plink_1.start()
  12. Plink_2.start()
  13. Plink_3.start()
  14.  
  15. import subprocess
  16. def make_shells(n):
  17. for i in range(n):
  18. subprocess.Popen(["cmd.exe"])
  19.  
  20. import paramiko
  21. def run_ls_la():
  22. client = paramiko.SSHClient()
  23. client.connect("myssh.server.org", username="foo", password="bar")
  24. stdin, stdout, stderr = client.exec_command("ls -la")
  25. print(stdout.read())
Add Comment
Please, Sign In to add comment