whidden

whidden.vbs

Option Explicit
Dim wshShell, strCommand, i

If WScript.Arguments.Count = 0 Then
    WScript.Echo "用法:whidden <程序> [参数...]"
    WScript.Quit 1
End If

'参数已被 cmd 拆开,拼回命令时重新加引号,避免路径里的空格被拆开
strCommand = Quote(WScript.Arguments(0))
For i = 1 To WScript.Arguments.Count - 1
    strCommand = strCommand & " " & Quote(WScript.Arguments(i))
Next

On Error Resume Next
Set wshShell = WScript.CreateObject("WScript.Shell")
wshShell.Run strCommand, 0, False

Function Quote(ByVal strText)
    Quote = """" & Replace(strText, """", """""") & """"
End Function