使用 vbscript 安装应用程序 [英] installing application with vbscript

查看:47
本文介绍了使用 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"

谢谢

推荐答案

使用

  1. 处理引用的函数
  2. 用于存储命令组件的数组
  3. Join()处理空格/分隔符
  1. a function to handle quoting
  2. an array to store the components of the command
  3. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆