(.vbs) need help with if exists & lists

August 17, 2010 at 18:17:55
Specs: Windows XP
Here's a example of what i'm trying to do


Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("C:\windows\ehome\ehshell.exe") Then
    filever = objFSO.GetFileVersion("C:\windows\ehome\ehshell.exe")

If file exists then

Compare file version to lists
if filever exists on VerList1 then echo List 1
if filever exists on VerList2 then echo List 2
if filever exists on VerList3 then echo List 3

Else

'If file does not exist then check registy entries

If registyentry1 exists then Echo Registry 1
If registyentry2 exists then Echo Registry 2
If registyentry3 exists then Echo Registry 3

VerList1
---------
5.1.2600.1106
5.1.2600.1142


VerList2
---------
5.1.2600.1217
5.1.2600.1312
5.1.2600.2096
5.1.2600.2149
5.1.2600.2180


I'm not sure how to do this

Note: I'm still learning vb scripts


See More: (.vbs) need help with if exists & lists

Report •


#1
August 18, 2010 at 16:37:39
If anyone who has Windows XP Media Center Edition would like to test this script please do so and let me know if it works

' 
' WinNT: XP Media Center Edition / Windows Media Center
' Created By 38956
'             21100819.4 Alpha 1026

Dim objFSO
Dim shell, envProcess

set shell = createobject("wscript.shell")    
set envProcess = shell.Environment("process")  
  windir = envProcess("windir")

Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(windir & "\ehome\ehshell.exe") Then
 MCEver = objFSO.GetFileVersion(windir & "\ehome\ehshell.exe")

  If InStr(1,MCEver,"5.1.2600") = 1 then 
    MCEbuild = Right("0" & MCEver, 4)

     If MCEbuild < "1217" then
      WScript.Echo "Windows XP Media Center Edition: 2002"
     ElseIf MCEbuild => "1217" then
      WScript.Echo "Windows XP Media Center Edition: 2004"
     End If

   ElseIf InStr(1,MCEver,"5.1.27") = 1 then 
    WScript.Echo "Windows XP Media Center Edition: 2005"
   ElseIf InStr(1,MCEver,"6.0") = 1 then 
    WScript.Echo "Windows Media Center in Windows Vista"
   ElseIf InStr(1,MCEver,"6.1") = 1 then 
    WScript.Echo "Windows Media Center in Windows 7"
   Else
    WScript.Echo "Media Center File Version: " & MCEver
   End If

Else
 WScript.Echo "Media Center: NOT FOUND"

End If



Report •
Related Solutions


Ask Question