vbs可以调用python脚本吗?

Python015

vbs可以调用python脚本吗?,第1张

可以,在vbs中用wshell.run执行脚本文件,前提是你系统中已部署好pyhton:

Set oShell = WScript.CreateObject ("WSCript.shell")

oShell.run "s.py"

Set oShell = Nothing

效果如下:

单纯 bat 本身并不具备隐藏运行的功能 不过用vbs调用bat就可以实现 Set ws = CreateObject("Wscript.Shell") ws.run "cmd /c 2002.bat",vbhide 这个就是vbs调用同目录下 名为 2002.bat 的批处理隐藏运行

import time

#from 调用VBS语音播读 import h_读

def h_读(a):

return a

wt1 = input(h_读('您好,欢迎古灵阁,请问您需要帮助吗?1需要or2不需要?'))

if wt1 == '1' or wt1 == '需要':

wt2 = input(h_读('请问您需要什么帮助呢?1存取款,2货币兑换,3咨询'))

if wt2 == '1' or wt2 == '存取款':

print(h_读('小精灵推荐你去存取款窗口;'))

elif wt2 == '2' or wt2 == '货币兑换':

print(h_读('金加隆和人民币的兑换率为1:51.3,即一金加隆=51.3人民币,桥等于10亿'))

time.sleep(1)

wt3 = input(h_读('请问您需要兑换多少金加隆呢?'))

time.sleep(1)

if wt3 == '桥':

print(h_读('恭喜你中奖了。'))

try:

wt33 = float(wt3)

print(h_读('好的,我知道了,您需要兑换' + wt3 + '金加隆。'))

time.sleep(1)

print(h_读('正在计算'))

time.sleep(1)

wt34 = wt33 * 51.3

wt35 = str(wt34)

print(h_读('那么,您需要付给我' + wt35 + '人民币'))

except:

if wt3 != '桥':

print(h_读('你输入的不是数字。把你关起来呀'))

else:

print(h_读('小精灵推荐你去咨询窗口'))

else:

print(h_读('好的,再见。'))

input(h_读("再见"))

这个实例你运行一下就明白了