Run script from batch

User avatar
agibsonsw
SilverLounger
Posts: 2403
Joined: 05 Feb 2010, 22:21
Location: London ENGLAND

Run script from batch

Post by agibsonsw »

Hello.
How do I run a vbscript file (.vbs) from a batch file? I tried just entering
C:\Documents and Settings\Andy G\Desktop\Test.vbs
in the Batch file, but no joy.
Thanks, Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.

User avatar
John Gray
PlatinumLounger
Posts: 5408
Joined: 24 Jan 2010, 08:33
Location: A cathedral city in England

Re: Run script from batch

Post by John Gray »

I've never done it - but certainly (at least) you need to surround the entire line with double-quotes...

Code: Select all

"C:\Documents and Settings\Andy G\Desktop\Test.vbs"
John Gray

"(or one of the team)" - how your appointment letter indicates you won't be seeing the Consultant...

User avatar
agibsonsw
SilverLounger
Posts: 2403
Joined: 05 Feb 2010, 22:21
Location: London ENGLAND

Re: Run script from batch

Post by agibsonsw »

Great "and simple", thanks.

A similar question, how can I run an application from a (vb) script?
I tried
Shell "Notepad.Exe"
but it doesn't work - I can use Shell directly from MS Excel, so why not vbscript?
Thanks again. Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.

NYIntensity
Lounger
Posts: 47
Joined: 26 Jan 2010, 01:05

Re: Run script from batch

Post by NYIntensity »

I think you need to start it with wscript.exe or cscript.exe; your batch file would look something like

@echo off
wscript.exe "C:\Documents and Settings\Andy G\Desktop\Test.vbs"