如何使用python脚本启动外部可执行文件? 我想启动安装在特定目录中的putty.exe,比如名为“putty”的文件夹中的C盘。 我正在从命令提示符D:\ python> Test.py。
执行脚本Test.py.我目前正在执行以下无效的操作 进口口; print os.system('putty.exe')
答案 0 :(得分:1)
使用命令行选项加载具有正确IP地址的已保存会话
The `-load' option causes PuTTY to load configuration details out
of a saved session. If these details include a host name, then this
option is all you need to make PuTTY start a session.
You need double quotes around the session name if it contains
spaces.
If you want to create a Windows shortcut to start a PuTTY saved
session, this is the option you should use: your shortcut should
call something like
d:\path\to\putty.exe -load "my session"
(Note that PuTTY itself supports an alternative form of this option,
for backwards compatibility. If you execute `putty @sessionname' it
will have the same effect as `putty -load "sessionname"'. With the
`@' form, no double quotes are required, and the `@' sign must be
the very first thing on the command line. This form of the option is
deprecated.)
答案 1 :(得分:-1)
你可以试试这个:
os.system ('C:/putty/putty.exe')