我收到了一个安装项目(.VDProject / Deployment 项目),它需要一个 dll 并提取到某个位置。
我的目标是在将文件复制到正确的位置后,在安装/卸载结束时重新启动某个 Windows 服务。
这样做的正确方法是什么?通过 VBS 在“自定义操作”的“提交”和“卸载”部分?
此脚本不起作用:
Set oshell = createobject("Wscript.Shell")
oshell.run"cmd.exe"
wscript.sleep 500
oshell.sendkeys "net stop ""MyService"""+("{Enter}")
wscript.sleep 5000
oshell.sendkeys "net start ""MyService"""+("{Enter}")
wscript.sleep 5000
oshell.sendkeys "exit"+("{Enter}")
set oshell = nothing
WScript.Quit