很抱歉有任何问题,但这是我在这里的第一篇文章,并提前感谢您的任何意见。
我需要从CMD运行以下命令: C:\Users\Name\Documents\CRT\SecureCRT.EXE /S \DEVICES\device,其中设备将从列表中添加到循环中。
我得到了以下信息:
for p in devices:
subprocess.Popen([r'C:\Users\Name\Documents\CRT\SecureCRT.EXE /S'] + devices)我得到以下错误: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
发布于 2020-07-25 15:55:26
我认为你必须使用这个subprocess.Popen(r'C:\Users\Name\Documents\CRT\SecureCRT.EXE /S‘+设备)
使用// insted of /
发布于 2020-07-26 20:35:32
此命令可解决此问题。
for p in devices:
subprocess.Popen([r'C:\Users\Name\Documents\CRT\SecureCRT.EXE', '/T', '/S', '\\DEVICES\\CORE\\' + p])https://stackoverflow.com/questions/63085771
复制相似问题