mIRC Home    About    Download    Register    News    Help

Print Thread
#204413 19/09/08 08:15 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
$os returning 95, 98, NT, ME, 2K, XP, or NET, any way i can return the full name of the os and the version of it? havent found anything about that in the help file, and i don't want to load a DLL just for it.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
sparta #204418 19/09/08 11:35 AM
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
if $os == 95 { return Microsoft Windows 95 }

and so on?


billythekid
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
it dosent return vista, and i want to identify the version of windows installed.. as for mine:

Operating system: WinXP Professional 5.1 Service Pack 2 (Build #2600).


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
sparta #204423 19/09/08 12:49 PM
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
COM? the moo script doesn't use the dll anymore and does com calls instead I think.
http://www.hm2k.com/projects/moo

Last edited by billythekid; 19/09/08 12:52 PM.

billythekid
sparta #204426 19/09/08 01:47 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
//echo -a > $os

> Vista



-genius_at_work

Joined: Mar 2007
Posts: 218
V
Fjord artisan
Offline
Fjord artisan
V
Joined: Mar 2007
Posts: 218
Same. wink

sparta #204437 19/09/08 07:47 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
You can use WMI to get this information. It should work on most systems with recent versions of Windows (probably not on 9x systems). The following generic $wmi() identifier can be used to easily retrieve the OS version info:
Code:
; $wmi(class,N,property[,timeout])
; class: name of the WMI class to be used
; N: the Nth class instance. N can be 0, to return the total number of instances
; property: the property of interest (ignored if N = 0)
; timeout (optional): number of seconds the COM connection is kept open (default is 120 seconds)
alias wmi {
  if $0 < 2 || ($0 == 2 && $2 != 0) { return }
  if !$com($1) {
    .comopen $1^loc WbemScripting.SWbemLocator
    if ($comerr) return
    .comclose $1^loc $com($1^loc,ConnectServer,3,dispatch* $1^con)
    if ($com($1^con)) .comclose $v1 $com($v1,InstancesOf,3,bstr*,$1,dispatch* $1)
    if (!$com($1)) return
  }
  .timerwmi: $+ $1 -oi 1 $iif($0 > 2 && $($ $+ $0,2) isnum 0-,$v1,120) if ($com( $1)) .comclose $1
  if ($2 == 0) return $comval($1,$2)
  return $comval($1,$2,$3)
}
Then you can try this:

//echo -ag $wmi(Win32_OperatingSystem,1,Caption) $iif($wmi(Win32_OperatingSystem,1,ServicePackMajorVersion),SP $+ $v1)

You can use any of the properties listed here if you need more information (eg BuildNumber).

Edit: small correction

Last edited by qwerty; 20/09/08 12:04 PM.

/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
sparta #204438 19/09/08 08:19 PM
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

What version of mIRC are you using sparta?

RoCk #204445 20/09/08 06:42 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I use 6.21 to 6.34, but qwerty's example worked just fine, and i liked the page he linked to, have some reading to do smile thanx


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Link Copied to Clipboard