Need to run SecureCRT session from the CMD

426 views Asked by At

Sorry for any issues but this is my first post here and thank you in advance for your any comments.

I need to run following command from the CMD: C:\Users\Name\Documents\CRT\SecureCRT.EXE /S \DEVICES\device where device will be added in the loop from the list.

I got following:

for p in devices:
    subprocess.Popen([r'C:\Users\Name\Documents\CRT\SecureCRT.EXE /S'] + devices)

I got follwing error: Traceback (most recent call last): File "C:\Users\Name\Documents\TICKETS\2020\July 2020\Change start stop2.py", line 89, in <module> subprocess.Popen([r'C:\Users\Name\Documents\CRT\SecureCRT.EXE /S'] + devices) File "C:\Users\Name\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 709, in __init__ restore_signals, start_new_session) File "C:\Users\Name\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 997, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified

2

There are 2 answers

0
Ujjwal Dash On BEST ANSWER

I think you have to use this subprocess.Popen([r'C:\Users\Name\Documents\CRT\SecureCRT.EXE /S'] + devices)

Use // insted of /

0
nowy On

This command fix the issue.

for p in devices:
subprocess.Popen([r'C:\Users\Name\Documents\CRT\SecureCRT.EXE', '/T', '/S', '\\DEVICES\\CORE\\' + p])