This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: invoke vbscript from cygwin?


Dave Burns wrote:

> How would one invoke a vbscript from cygwin, if it is possible? I
> guess invoking cygwin from a vbscript would also do the trick, though
> I'd rather not have to fiddle with the vbscript at all.

You invoke it the same way you would from a Windows command prompt, i.e.
cscript.exe or wscript.exe.

$ echo 'MsgBox ("Hello World!")' > foo.vbs

$ cscript //nologo foo.vbs

As far as "invoking Cygwin from a vbscript", that is too vague.  Cygwin
is not an abstract entity, it's a bunch of programs.  If you want to
invoke one of them it's no different than invoking any other program --
you have a command and some arguments and you run it.  If you want to
run more than a simple command you probably need to involve the shell
with -c, e.g. 

$ cat <<EOF >foo.vbs
Set x = WScript.CreateObject("WScript.Shell")
Set y = x.Exec("c:\cygwin\bin\bash -c 'echo hello world from bash'")
WScript.StdOut.Write(y.StdOut.ReadAll())
EOF

$ cscript //nologo foo.vbs
hello world from bash

Just like with anything you need to either add the Cygwin bin directory
to the PATH, set the working dir to the bin directory, or specify the
full pathname to the .exe.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]