Anthony Miller
Anthony Miller

Reputation: 15920

How to run a .vbs from a .bat

Created an extensive batch script program to handle some automated file management and printing and I need to call a vbs file for its sendkeys operation. Is there a way to accomplish this without freezing the program?

I've tried START /WAIT my.vbs and the script freezes when it enters the .vbs

Anyone have other methods or switches you would recommend?

I would like it to run silently if at all possible, and i need the /WAIT switch because I need the sendkeys operation to complete prior to the next step in the batch file.

Upvotes: 5

Views: 104645

Answers (4)

Mani Kasi
Mani Kasi

Reputation: 240

Just Call The vbs file correct path

The BAT file Edit it...!!!

wscript "file-path"

Example:

wscript "D:\KmaniZoro\PGM\N++\VBS\inputbox.vbs"

Upvotes: 2

Saji Samsaji
Saji Samsaji

Reputation: 41

Create the .vbs file Then open the Batch file and enter START "" "FILE PATH"

EG: Start "" "C:\Users\%Username%\Desktop\Spiritual Aid\Program\2.vbs"

IT WORKED PERFERCTLY IN MY COMPUTER.

Upvotes: 0

timeout 5
timeout 5

Reputation: 1

timeout 5 timeout /?

TIMEOUT [/T] timeout [/NOBREAK]

Description: This utility accepts a timeout parameter to wait for the specified time period (in seconds) or until any key is pressed. It also accepts a parameter to ignore the key press.

Parameter List: /T timeout Specifies the number of seconds to wait. Valid range is -1 to 99999 seconds.

/NOBREAK                Ignore key presses and wait specified time.

/?                      Displays this help message.

NOTE: A timeout value of -1 means to wait indefinitely for a key press.

Examples:  

TIMEOUT /?
TIMEOUT /T 10
TIMEOUT /T 300 /NOBREAK
TIMEOUT /T -1

Upvotes: 0

wimh
wimh

Reputation: 15232

Instead of using START /WAIT my.vbs you could try using cscript //NoLogo //B my.vbs. You can also pass other options to cscript that way.

Upvotes: 7

Related Questions