문제

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,

도움이 되었습니까?

해결책

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!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top