Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Running vbs file from TCL

447 views
Skip to first unread message

Eran....@gmail.com

unread,
May 2, 2006, 5:20:12 AM5/2/06
to
Hi,

I am new to TCL. I need to launch a vbs from inside a TCL file type.
Can anyone help me with that?

TIA.

Eckhard Lehmann

unread,
May 2, 2006, 5:54:33 AM5/2/06
to

The simplest solution is [exec] (set res [exec file.vbs]).
More advanced is to rewrite it in Tcl ;-).


Eckhard

Eran....@gmail.com

unread,
May 3, 2006, 5:35:09 AM5/3/06
to

Do I need to write the file name insdide quotation mark? meaning
(set res [exec "c:\\1.vbs"]).

Eckhard Lehmann

unread,
May 3, 2006, 6:19:06 AM5/3/06
to

Eran....@gmail.com wrote:

> Do I need to write the file name insdide quotation mark? meaning
> (set res [exec "c:\\1.vbs"]).

Doesn't matter - as long as you escape white spaces with \
It is also perfectly ok to write C:/1.vs instead of C:\\1.vbs. It
decreases the number of \ in path names...


Eckhard

Eran....@gmail.com

unread,
May 3, 2006, 2:55:45 PM5/3/06
to
thanks a lot for your help.

Eran....@gmail.com

unread,
May 4, 2006, 1:50:32 AM5/4/06
to
not working. When I use the following commnand:
"set res [exec "c:\\1.vbs"]" or "set res [exec "c:/1.vbs"]" I get an
error message:
Couldn't execute: "c:\1.vbs" no such file or directory.

This is weird becuse I do have file 1.vbs at c:\

what's the reason? I use TCL 8.3.

BTW, Should I install newer TCL version due to critical bug fix in
newer TCL version?

Eckhard Lehmann

unread,
May 4, 2006, 2:44:30 AM5/4/06
to

Eran....@gmail.com wrote:
> not working. When I use the following commnand:
> "set res [exec "c:\\1.vbs"]" or "set res [exec "c:/1.vbs"]" I get an
> error message:
> Couldn't execute: "c:\1.vbs" no such file or directory.
>
> This is weird becuse I do have file 1.vbs at c:\
>
> what's the reason? I use TCL 8.3.

[exec] works only with executable files. I just google'd around and
found out that .vbs files need an interpreter called "wscript.exe". So,
to make it work, you have to update the command: "set res [exec wscript
C:/1.vbs]", given wscript is in your PATH. Try it by opening a cmd and
type "wscript C:\1.bs". This works for me.

Maybe recode it really in Tcl, after all..... ;-)?


> BTW, Should I install newer TCL version due to critical bug fix in
> newer TCL version?

No, I don't think so... But 8.3 is really old. If you want to be more
up to date I recommend to install 8.4. Prebuilt binaries are available
from ActiveState (www.activestate.com, browse for ActiveTcl).
BTW 1: A very nice way to run Tcl scripts is Tclkit, which can be found
at http://www.equi4.com/. With this, no installation at all is
required.
BTW 2: the next version 8.5 is around the corner, you can even try
this...


Eckhard

Dennis LaBelle

unread,
May 4, 2006, 6:11:18 PM5/4/06
to
Eran....@gmail.com wrote:

You may want to try:

set res [exec {cmd.exe /c start c:/1.vbs}]

This will cause the Windows command shell interpreter to find the
appropriate Visual Basic script engine for you.

Cameron Laird

unread,
May 5, 2006, 11:47:08 AM5/5/06
to
In article <a_u6g.6412$TT....@twister.nyroc.rr.com>,
Dennis LaBelle <labe...@nycap.rr.com> wrote:
.
.
.

>You may want to try:
>
>set res [exec {cmd.exe /c start c:/1.vbs}]
>
>This will cause the Windows command shell interpreter to find the
>appropriate Visual Basic script engine for you.

? It doesn't for me ...

... and aren't $env(COMSPEC) and auto_execok the right generalizations
of cmd.exe? I'll make that explicit: more general *and* correct even
than what Dennis wrote is

set res [eval exec [auto_execok start] c:/1.vbs]

I believe.

Dennis LaBelle

unread,
May 6, 2006, 8:21:25 AM5/6/06
to
Cameron Laird wrote:

Yes, auto_execok is a more generalized version. However, cmd.exe should work
on any Windows NT or newer version of Windows.

I also haven't seen any Windows XP systems on which the start command
couldn't execute a VBS file.

So I was assuming people were dealing with a somewhat recent version of
Windows.

Cameron Laird

unread,
May 6, 2006, 10:33:41 AM5/6/06
to
In article <9x07g.23691$ZQ3....@twister.nyroc.rr.com>,

Dennis LaBelle <labe...@nycap.rr.com> wrote:
>Cameron Laird wrote:
>
>> In article <a_u6g.6412$TT....@twister.nyroc.rr.com>,
>> Dennis LaBelle <labe...@nycap.rr.com> wrote:
>> .
>> .
>> .
>>>You may want to try:
>>>
>>>set res [exec {cmd.exe /c start c:/1.vbs}]
.
.

.
>Yes, auto_execok is a more generalized version. However, cmd.exe should work
>on any Windows NT or newer version of Windows.
>
>I also haven't seen any Windows XP systems on which the start command
>couldn't execute a VBS file.
>
>So I was assuming people were dealing with a somewhat recent version of
>Windows.

I think we're confusing each other. What exact display do
you see when you run

exec {cmd.exe /c start c:/1.vbs}

? Apart from questions about which version of Windows any
of us are running, or whether c:\1.vbs is present on a
particular host, I believe there's an issue with the
semantics of [exec].

Dennis LaBelle

unread,
May 6, 2006, 1:38:00 PM5/6/06
to
Cameron Laird wrote:

Sorry about that. The correct command should be: (now that I've had enough
sleep)

set res [exec cmd.exe /c start c:/1.vbs]

I actually tried this on my Windows XP system and it works.

0 new messages