#1 28 Mar 2012 09:23

trekxor
Member
From: UK
Registered: 28 Mar 2012
Posts: 1

Hope you guys can help.

Hi,
I have a batch fille that starts all my Programs that I need (7), I was very happy with it until i tried the same in VB

Cmd to start program (minimized)

@echo off
start "" /min "C:\Windows\system32\dsac.exe"

VB Script to start Program

strProgramPath = """C:\Windows\system32\dsac.exe"""
SET objShell = CREATEOBJECT("Wscript.Shell")
objShell.Run strProgramPath

The VB script seems to do the job faster but is there a way to make it look a bit better than repating that 7 times with different path in each one?
I'm also looking for a way to control the minimum, maximised state (as per the cmd above) via the VB.

Thanks for taking the time...

T.

Offline

#2 29 Mar 2012 23:10

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 1,026
Website

Re: Hope you guys can help.

I kinda doubt you will see any noticeable  performance difference between launching with CMD vs VBS, you may just be seeing the affect of disc caching.

A different approach is to put all the paths in a single shortcut:

set the Target to
cmd /c start "" /min "C:\Windows\system32\dsac.exe" &  start "" /min Write.exe &  start "" /min SomeOtherProgram.exe

Offline

#3 11 May 2012 13:57

sarbjitsinghgill
Member
From: TORONTO CANADA
Registered: 09 Dec 2007
Posts: 112
Website

Re: Hope you guys can help.

trekxor wrote:

Hi,
is there a way to make it look a bit better than repating that 7 times with different path in each one?
I'm also looking for a way to control the minimum, maximised state (as per the cmd above) via the VB.

Thanks for taking the time...

T.

Won't be much useful. Basically what I have understood that you want to run all 7 commands ( programs) in one line. If I got it right then there are many ways that you can do it; but each way command will be repeate 7 times. It may be repeated by your main code, sub-code or interpreter ( as Simon's example) or even another executable.

Different paths cannot be made to work usually with interpreters ; as they are different they haver to be specified differently.

I would declare an array in vbscript and iterate with for loop.

Startup states are controlled by using intWindowStyle. http://ss64.com/vb/run.html.

Do you have any problem with shell.run ; it is perfect.

I do agree with you that vbscript executions are faster; whatever reson may be.

Regards


Sarbjit Singh Gill
IBM certified DBA, MQ Solution Developer

Offline

#4 01 Jul 2012 23:36

Dylany_1
Member
Registered: 01 Jul 2012
Posts: 9

Re: Hope you guys can help.

If you want to run something hidden from the taskbar input this into a VBS file:

CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

Then you need a batch file to run the two, the VBSscript and the program/application so input this into batch:

wscript.exe "%userprofile%\desktop\hidden.vbs" "Application.exe"

To run it, just simply start the batch file you made for it.

Offline

Board footer

Powered by FluxBB