Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
795 views
in Technique[技术] by (71.8m points)

vbscript - VBS (Visual Basic Script) Run Program hidden/invisible

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.

Here is my code so far:

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

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

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:

Batch File: Main file launching VBS file

@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:WindowssysWOW64csript.exe C:UsersAdminRunInternetProcessvbscript.vbs

vbscript.vbs

Set ie = CreateObject("InternetExplorer.Application")

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

Make a batch file: ExecuteServerVBS.bat

C:windowssysWOW64cscript.exe C:pathoyourvbscript.vbs

Put your vbscript code here:

vbscript.vbs

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

And BOOM. You're done.

UPDATE

update the file ExecuteServerVBS.vbs

@echo off
C:WindowssysWOW64cscript.exe C:UsersAdminRunInternetProcessvbscript.vbs > errorlog.log

update the file 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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...