VBS (Visual Basic Sc​​ript) 运行程序隐藏/不可见 [英] VBS (Visual Basic Script) Run Program hidden/invisible

查看:80
本文介绍了VBS (Visual Basic Sc​​ript) 运行程序隐藏/不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行一个对 VB 脚本隐藏/不可见的程序(在本例中为 Internet Explore).

I am trying to run a program (In this case Internet Explore) hidden/invisible from a VB script.

我找到了一个用于隐藏批处理文件的简单脚本,并尝试了它.它似乎没有工作,因为程序只是正常弹出.

I found a simple script for making batch files hidden, and tried it. It didn't seem to work as the program just popped up as normal.

这是我目前的代码:

CreateObject("Wscript.Shell").Run "iexplore.exe",0,True

这会运行程序 iexplore.exe,但不会隐藏/不可见地运行它.

This runs the program iexplore.exe, but doesn't run it hidden/invisible.

我也在从一个隐藏的批处理文件运行这个 VBS 文件.批处理文件只是:

I am also running this VBS file from a batch file which is hidden. The batch file simply does:

start Run.vbs

每个脚本/批处理文件的代码:

Codes of each script/batch file:

批处理文件:启动VBS文件的主文件

@echo off
:start
start HideExecuteServerVBS.vbs (To Hide the ExecuteServerVBS.bat file when running)
timeout /NOBREAK /T 5
TASKKILL /IM iexplore.exe
timeout /NOBREAK /T 3
TASKKILL /IM iexplore.exe /F
timeout /NOBREAK /T 1800
goto start

HideExecuteServerVBS.vbs

CreateObject("Wscript.Shell").Run "ExecuteServerVBS.bat",0,True

ExecuteServerVBS.vbs

@echo off
C:\Windows\sysWOW64\csript.exe C:\Users\Admin\RunInternetProcess\vbscript.vbs

vbscript.vbs

Set ie = CreateObject("InternetExplorer.Application")

是否有可能通过 VB 脚本(Visual Basic 脚本)运行不可见的程序?

Is there a possible way to run a program invisible through a VB Script (Visual Basic Script)?

推荐答案

问题是这样的,如果您收到 ActiveX 错误,您很可能正在尝试在服务器下运行此 vbscript.64 位平台的服务器不支持直接执行 32 位 vbscripts?是的?如果是这样,这就是您需要做的.

So here's the deal, if you are receiving an ActiveX error, you most likely are trying to run this vbscript under a server. Server with a 64bit platform with lack of support for direct execution of 32bit vbscripts? Yeah? If so, here's what you need to do.

制作批处理文件:执行ServerVBS.bat

Make a batch file: ExecuteServerVBS.bat

C:\windows\sysWOW64\cscript.exe C:\path\to\your\vbscript.vbs

将您的 vbscript 代码放在这里:

Put your vbscript code here:

vbscript.vbs

vbscript.vbs

Set ie = CreateObject("InternetExplorer.Application")
'Go crazy 

还有繁荣.你完成了.

更新

更新文件ExecuteServerVBS.vbs

@echo off
C:\Windows\sysWOW64\cscript.exe C:\Users\Admin\RunInternetProcess\vbscript.vbs > errorlog.log

更新文件vbscript.vbs

On Error Resume Next
Dim ie 
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = False
'Perform IE functions here......
If err.number <> 0 then wscript.echo err.number & ":" & err.description

这篇关于VBS (Visual Basic Sc​​ript) 运行程序隐藏/不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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