您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

用python创建的参数执行vbs文件

用python创建的参数执行vbs文件

要详细说明安斯加的补救措施:

从命令行“ works”启动.vbs,因为外壳程序将扩展名.vbs与应用程序关联(例如cscript / wscript;请参阅ftype,assoc,cscript // E,cescript // S)。

subprocess.call()不会打开外壳程序,因此可以指定应用程序(c|wscript.exe)或自己启动外壳程序:

import subprocess

#subprocess.call("notepad") # works

#subprocess.call("dir") # [Error 2] The system cannot find the file specified
                        # no shell, no intrinsics

#subprocess.call("19112944.vbs") # [Error 193] %1 is not a valid Win32 application
                                 # no shell, can't associate .vbs with c|wscript.exe

subprocess.call("cscript 19112944.vbs") # works

subprocess.call("cmd /c 19112944.vbs") # works
                                       # have shell, can associate .vbs with c|wscript.exe
python 2022/1/1 18:42:15 有280人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶