Masum Nishat
Masum Nishat

Reputation: 368

Sending a process to background in vbs

I am using a code like,

Dim sh
Set sh = WScript.CreateObject("WScript.Shell")
sh.run "cmd /K a.exe & exit",0,false
Set sh = Nothing

It works fine to start a background process. But when, i call a.bat file contained,

start b.bat

then b.bat is not hiding. which way is batter to hide b.bat also? can i take this b.bat from foreground to background?

Upvotes: 1

Views: 1688

Answers (1)

Bond
Bond

Reputation: 16311

Specifying 0 (hidden) as the 2nd param to Run() does hide the batch file. But it doesn't hide the windows of any programs launched by the batch file.

So... is your BAT file trying to launch a program? If so, can it be launched by VBScript instead so that it may be hidden?

On a side note, you know you can use CMD /C in lieu of CMD /K "... & Exit", right?

Upvotes: 1

Related Questions