小编Sud*_*amy的帖子

VBScript执行成功后如何关闭CMD提示窗口

我正在从另一个调用 VBScript 以管理员身份运行。以下是 Invoker VBScript 代码

Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "cscript", "C:\Temp\XYZ.vbs", "", "runas", 0
Wscript.Quit 1
Run Code Online (Sandbox Code Playgroud)

以下是 XYZ.vbs 代码

On Error Resume Next 

Dim strComputerRole, strDomain, strComputer, strText, strText2
Dim arrServiceList, strNextLine
Dim objFile, objFile2, strFile, strSysDrive, strTempDir, strSQLcommand

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = wscript.createObject("Wscript.Shell")
Set colProcEnvVars = objShell.Environment("Process")
Set colSystemEnvVars = objShell.Environment("System")

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
strSysDrive = colProcEnvVars("systemdrive")
strTempDir = colProcEnvVars("SY0")

Const ForReading = …
Run Code Online (Sandbox Code Playgroud)

vbscript cmd wsh shellexecute

2
推荐指数
1
解决办法
7452
查看次数

标签 统计

cmd ×1

shellexecute ×1

vbscript ×1

wsh ×1