使用 vbscript 安装应用程序 [英] installing application with vbscript
本文介绍了使用 vbscript 安装应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将此cmd命令转换为vb脚本或powershell
I would like to convert this cmd command to vb script or powershell
c:\windows\system32\certutil.exe -f -addstore "TrustedPublisher" "Mycert.cer"
我的问题是在TrustedPublisher"Mycert.cer"之间创建空间
My problem is creating the space between "TrustedPublisher" "Mycert.cer"
谢谢
推荐答案
使用
- 处理引用的函数
- 用于存储命令组件的数组
- Join()处理空格/分隔符
- a function to handle quoting
- an array to store the components of the command
- Join() to deal with spaces/separators
以结构化方式构建您的命令行.在代码中:
to build your commandline in a structured way. In code:
Option Explicit
Function qq(s) : qq = """" & s & """" : End Function
Dim aParts : aParts = Array( _
qq("c:\windows\system32\certutil.exe") _
, "-f" _
, "-addstore" _
, qq("TrustedPublisher") _
, qq("Mycert.cer") _
)
Dim sCmd : sCmd = Join(aParts)
WScript.Echo sCmd
输出:
cscript 29649158.vbs
"c:\windows\system32\certutil.exe" -f -addstore "TrustedPublisher" "Mycert.cer"
这篇关于使用 vbscript 安装应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文