Batch file 如何使用shell脚本隐藏地运行批处理文件?

Batch file 如何使用shell脚本隐藏地运行批处理文件?,batch-file,vbscript,Batch File,Vbscript,我正在处理shell script/.vbs扩展名文件,我想从shell脚本隐藏或在后台运行批处理文件。我提到我的代码,但它不是执行批处理文件。我已使用名称test.vbs保存了我的文件 Set WshShell = CreateObject() WshShell.Run chr(34) & "%USERPROFILE%\AppData\Local\RE.bat" & Chr(34), 0 Set WshShell = Nothing 提前感谢。您需要的是CreateObjec

我正在处理shell script/.vbs扩展名文件,我想从shell脚本隐藏或在后台运行批处理文件。我提到我的代码,但它不是执行批处理文件。我已使用名称
test.vbs
保存了我的文件

Set WshShell = CreateObject()
WshShell.Run chr(34) & "%USERPROFILE%\AppData\Local\RE.bat" & Chr(34), 0
Set WshShell = Nothing

提前感谢。

您需要的是
CreateObject(“WScript.Shell”)
,而不是
CreateObject()

Set WshShell=CreateObject(“WScript.Shell”)
WshShell.runchr(34)和“%USERPROFILE%\AppData\Local\RE.bat”&Chr(34),0

否则VBScript将不知道要创建什么!因此,它无法知道您想要具有
Run
方法的shell对象…

当您编写
CreateObject()
时,必须在这些圆括号中提及。您的代码看起来不错,只需在圆括号中添加
WScript.shell
,如下所示

Set WshShell = CreateObject("WScript.shell")