mIRC Homepage
Posted By: sparta $os question - 19/09/08 08:15 AM
$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.
Posted By: billythekid Re: $os question - 19/09/08 11:35 AM
if $os == 95 { return Microsoft Windows 95 }

and so on?
Posted By: sparta Re: $os question - 19/09/08 12:30 PM
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).
Posted By: billythekid Re: $os question - 19/09/08 12:49 PM
COM? the moo script doesn't use the dll anymore and does com calls instead I think.
http://www.hm2k.com/projects/moo
Posted By: genius_at_work Re: $os question - 19/09/08 01:47 PM
//echo -a > $os

> Vista



-genius_at_work
Posted By: vexed2 Re: $os question - 19/09/08 06:00 PM
Same. wink
Posted By: qwerty Re: $os question - 19/09/08 07:47 PM
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
Posted By: RoCk Re: $os question - 19/09/08 08:19 PM

What version of mIRC are you using sparta?
Posted By: sparta Re: $os question - 20/09/08 06:42 AM
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
© mIRC Discussion Forums