For Programmers: Free Programming Magazines  


Home > Archive > Tcl > September 2005 > tcl exec ver command









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author tcl exec ver command
martinkuria@hotmail.com

2005-09-29, 3:57 am

I would like to exec windows commands with tcl exec, it works ok but
when I try to execute ver command to view the windows operating system
using tcl exec it returns an error:

catch {exec ver} results
puts "$results"

returns:

Could'nt execute "ver": no such file or directory.

How come it does not recognize ver command which it runs ok from the
dos command prompt please do advice

Martin W

Arjen Markus

2005-09-29, 3:57 am

Normally you can do such things via:

exec [auto_execok ver]

to help Tcl add the right path and such. It seems however that
ver is command internal to DOS-batch files/command.com

The workaround is to use a batch-file instead.

Regards,

Arjen

suchenwi

2005-09-29, 7:57 am

A batch file isn't needed, just call what auto_execok gives you, but
with an added [eval], as it's a call to cmd with arguments:

% exec ver
couldn't execute "ver": no such file or directory
% exec [auto_execok ver]
couldn't execute "C:\WINNT\system32\cmd.exe \c ver": no such file or
directory
% eval exec [auto_execok ver]

Microsoft Windows XP [Version 5.1.2600]

Arjen Markus

2005-09-29, 7:57 am

Oh dear, I forgot that!

Regards,

Arjen

gwl

2005-09-29, 7:01 pm

martinkuria@hotmail.com wrote:
> I would like to exec windows commands with tcl exec, it works ok but
> when I try to execute ver command to view the windows operating system...


Others have answered the question, but...

You do know about the array ::tcl_platform don't you?

It may contain everything you need.
suchenwi

2005-09-29, 7:01 pm

Well, while "ver" gives me 5.1.2600 (see above), tcl_platform is not so
precise:
tcl_platform(byteOrder) = littleEndian
tcl_platform(machine) = intel
tcl_platform(os) = Windows NT
tcl_platform(osVersion) = 5.1
tcl_platform(platform) = windows
tcl_platform(user) = suchrich
tcl_platform(wordSize) = 4
But I never bothered for the third-level number, indeed :)

gwl

2005-09-30, 7:00 pm

suchenwi wrote:
> Well, while "ver" gives me 5.1.2600 (see above), tcl_platform is not so
> precise:


That was why is said: "It **may** contain everything you need." (emphasis added)

> tcl_platform(byteOrder) = littleEndian
> tcl_platform(machine) = intel
> tcl_platform(os) = Windows NT
> tcl_platform(osVersion) = 5.1
> tcl_platform(platform) = windows
> tcl_platform(user) = suchrich
> tcl_platform(wordSize) = 4
> But I never bothered for the third-level number, indeed :)
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com