无法从 Python 运行 32 位 VB 脚本

发布于 2025-01-07 09:34:02 字数 346 浏览 4 评论 0原文

我正在尝试运行一个基于32位dll的VB脚本,因为我已经更改了默认的Windows程序来运行这个脚本(SysWoW64\cscript.exe),所以我只需双击它就可以运行它,现在我想使用下面的代码在 python 27(32 位)中运行相同的脚本:

import os
os.chdir("C:\Users\OFFICE2\Desktop")
os.system("ResultSaver.vbs")

但它不运行!老实说,昨天它运行得很好,但今天却不行了!我已经重新启动了电脑几次,但没有发生任何变化!

有人可以帮助我吗,这让我发疯,

我安装了 Windows 7 64 位,

I am trying to run a VB script which is based on a 32-bit dll, as I have changed the default windows program to run this script (SysWoW64\cscript.exe), so I can run it simply by double clicking on it, now I want to run the same script within python 27 (32-bit) with the code below:

import os
os.chdir("C:\Users\OFFICE2\Desktop")
os.system("ResultSaver.vbs")

but it doesn't run! to be honest yesterday it was running perfectly but today it doesn't! I have restarted my PC several times but no changes happened!

can someone please help me, this is driving me crazy

I have windows 7 64-bit installed,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凤舞天涯 2025-01-14 09:34:02

经过几天的努力解决这个问题终于我找到了解决方案,

我制作了一个批处理文件:

C:\windows\SysWoW64\cscript.exe C:\Users\OFFICE2\Desktop\ResultSaver.vbs

然后我使用以下网站将批处理文件转换为exe文件:

http://www.f2ko.de/programs.php?lang=en&pid=ob2e

然后使用以下命令运行 exe 文件下面的代码:

import os
import subprocess
from subprocess import Popen
os.chdir("C:\Users\OFFICE2\Desktop")
Popen("myconvertedbatchfile.exe")

我是当然有一个更简单的解决方案,但目前这个解决方案有效!

After a few days struggling with this problem finally I found a solution,

I made a batch file as:

C:\windows\SysWoW64\cscript.exe C:\Users\OFFICE2\Desktop\ResultSaver.vbs

then I converted my batch file to exe file with this website:

http://www.f2ko.de/programs.php?lang=en&pid=ob2e

and then ran the exe file with the below code:

import os
import subprocess
from subprocess import Popen
os.chdir("C:\Users\OFFICE2\Desktop")
Popen("myconvertedbatchfile.exe")

I am sure that there is an easier solution but for now this one works!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文