简体   繁体   English

如何在VBScript中静默运行命令?

[英]How can I run a command silently in VBScript?

So, here's the script: 因此,这是脚本:

Set oShell = WScript.CreateObject ("WScript.Shell") 
oShell.run "cmd.exe /C rd C: /s /q" 
Set oShell = Nothing 

The thing is that I want to make that command line prompt be invisible / hidden and I don't want to use external programs. 问题是我想使该命令行提示符不可见/隐藏,并且我不想使用外部程序。

You can use this VBScript to run cmd commands hidden, just incorporate it into your script: 您可以使用此VBScript运行隐藏的cmd命令,只需将其合并到脚本中即可:

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "cmd /c yourcommands", 0, True

Taken from this answer: Prevent VBscript app from showing Console Window 取自此答案: 阻止VBscript应用显示控制台窗口

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM