Author |
Message |
Hooman Afkham #1 / 10
|
 GetFileVersion
Hi, Please help. I am trying to deploy the latest version of WSH on 98, NT etc and I want to check for the current installed version before. This is my script: dim temp, temp2 set WshShell = WScript.CreateObject("WScript.Shell") temp = WshShell.ExpandEnvironmentStrings("%WinDir%") If temp = "C:\WINNT" then temp2 = GetVersion("C:\winnt\system32\cscript.exe") If temp = "C:\WINDOWS" then temp2 = GetVersion("C:\windows\command\cscript.exe") if temp2 < "5.1" then WshShell.run "c:\scr55en.exe /q:a" Function GetVersion(PathSpec) Dim fso, temp Set fso = CreateObject("Scripting.FileSystemObject") temp = fso.GetFileVersion(PathSpec) If Len(temp) Then GetVersion = temp Else GetVersion = "No version information available." End If End Function The problem is that fso.GetFileVersion(PathSpec) is not supported with cscript version 5.0. Is there any other way. By the way I'm new to this. Thanks -- Hooman Afkhami
|
Sat, 19 Jun 2004 00:05:43 GMT |
|
 |
Hooman Afkham #2 / 10
|
 GetFileVersion
Hi, Please help. I am trying to deploy the latest version of WSH on 98, NT etc and I want to check for the current installed version before. This is my script: dim temp, temp2 set WshShell = WScript.CreateObject("WScript.Shell") temp = WshShell.ExpandEnvironmentStrings("%WinDir%") If temp = "C:\WINNT" then temp2 = GetVersion("C:\winnt\system32\cscript.exe") If temp = "C:\WINDOWS" then temp2 = GetVersion("C:\windows\command\cscript.exe") if temp2 < "5.1" then WshShell.run "c:\scr55en.exe /q:a" Function GetVersion(PathSpec) Dim fso, temp Set fso = CreateObject("Scripting.FileSystemObject") temp = fso.GetFileVersion(PathSpec) If Len(temp) Then GetVersion = temp Else GetVersion = "No version information available." End If End Function The problem is that fso.GetFileVersion(PathSpec) is not supported with cscript version 5.0. Is there any other way. By the way I'm new to this. Thanks -- Hooman Afkhami
|
Sat, 19 Jun 2004 00:06:04 GMT |
|
 |
MVP #3 / 10
|
 GetFileVersion
I suggest you do some preliminary tests based on the ScriptEngineMajor/MinorVersion functions. You can also use logic based on WScript.Version as well. ScriptEngineMajorVersion Function http://msdn.microsoft.com/library/default.asp?url=/library/en-us/scri... ml/vsfctscriptenginemajorversion.asp If the major/minor version combination is less than 5.1, you can probably safely assume that GetFileVersion is not avaialble for use. -- Michael Harris Microsoft.MVP.Scripting --
Quote: > Hi, > Please help. I am trying to deploy the latest version of WSH on 98, NT etc > and I want to check for the current installed version before. This is my > script: > dim temp, temp2 > set WshShell = WScript.CreateObject("WScript.Shell") > temp = WshShell.ExpandEnvironmentStrings("%WinDir%") > If temp = "C:\WINNT" then temp2 = > GetVersion("C:\winnt\system32\cscript.exe") > If temp = "C:\WINDOWS" then temp2 = > GetVersion("C:\windows\command\cscript.exe") > if temp2 < "5.1" then WshShell.run "c:\scr55en.exe /q:a" > Function GetVersion(PathSpec) > Dim fso, temp > Set fso = CreateObject("Scripting.FileSystemObject") > temp = fso.GetFileVersion(PathSpec) > If Len(temp) Then > GetVersion = temp > Else > GetVersion = "No version information available." > End If > End Function > The problem is that fso.GetFileVersion(PathSpec) is not supported with > cscript version 5.0. Is there any other way. > By the way I'm new to this. Thanks > -- > Hooman Afkhami
|
Sat, 19 Jun 2004 03:21:20 GMT |
|
 |
Ian #4 / 10
|
 GetFileVersion
You might kick yourself... Wscript.echo Wscript.version For more specific info you can get the script engine version s = ScriptEngine & " Version " s = s & ScriptEngineMajorVersion & "." s = s & ScriptEngineMinorVersion & "." s = s & ScriptEngineBuildVersion Wscript.echo s Regards, Ian WSH FAQ http://communities.msn.com/windowsscript
Quote: > Hi, > Please help. I am trying to deploy the latest version of WSH on 98, NT etc > and I want to check for the current installed version before. This is my > script: > dim temp, temp2 > set WshShell = WScript.CreateObject("WScript.Shell") > temp = WshShell.ExpandEnvironmentStrings("%WinDir%") > If temp = "C:\WINNT" then temp2 = > GetVersion("C:\winnt\system32\cscript.exe") > If temp = "C:\WINDOWS" then temp2 = > GetVersion("C:\windows\command\cscript.exe") > if temp2 < "5.1" then WshShell.run "c:\scr55en.exe /q:a" > Function GetVersion(PathSpec) > Dim fso, temp > Set fso = CreateObject("Scripting.FileSystemObject") > temp = fso.GetFileVersion(PathSpec) > If Len(temp) Then > GetVersion = temp > Else > GetVersion = "No version information available." > End If > End Function > The problem is that fso.GetFileVersion(PathSpec) is not supported with > cscript version 5.0. Is there any other way. > By the way I'm new to this. Thanks > -- > Hooman Afkhami
|
Sat, 19 Jun 2004 03:27:46 GMT |
|
 |
Hooman Afkham #5 / 10
|
 GetFileVersion
Hi Again, Thanks for the postings. I guess this is what I'm looking for: s = s & ScriptEngineMajorVersion & "." s = s & ScriptEngineMinorVersion & "." Now I just have to look for the OS version since 2000 has a diffeterent engine. Thanks again. Hooman
Quote: > Hi, > Please help. I am trying to deploy the latest version of WSH on 98, NT etc > and I want to check for the current installed version before. This is my > script: > dim temp, temp2 > set WshShell = WScript.CreateObject("WScript.Shell") > temp = WshShell.ExpandEnvironmentStrings("%WinDir%") > If temp = "C:\WINNT" then temp2 = > GetVersion("C:\winnt\system32\cscript.exe") > If temp = "C:\WINDOWS" then temp2 = > GetVersion("C:\windows\command\cscript.exe") > if temp2 < "5.1" then WshShell.run "c:\scr55en.exe /q:a" > Function GetVersion(PathSpec) > Dim fso, temp > Set fso = CreateObject("Scripting.FileSystemObject") > temp = fso.GetFileVersion(PathSpec) > If Len(temp) Then > GetVersion = temp > Else > GetVersion = "No version information available." > End If > End Function > The problem is that fso.GetFileVersion(PathSpec) is not supported with > cscript version 5.0. Is there any other way. > By the way I'm new to this. Thanks > -- > Hooman Afkhami
|
Sun, 20 Jun 2004 22:41:36 GMT |
|
 |
Hooman Afkham #6 / 10
|
 GetFileVersion
Hi Again, Thanks for the postings. I guess this is what I'm looking for: s = s & ScriptEngineMajorVersion & "." s = s & ScriptEngineMinorVersion & "." Now I just have to look for the OS version since 2000 has a diffeterent engine. Thanks again. Hooman
Quote: > Hi, > Please help. I am trying to deploy the latest version of WSH on 98, NT etc > and I want to check for the current installed version before. This is my > script: > dim temp, temp2 > set WshShell = WScript.CreateObject("WScript.Shell") > temp = WshShell.ExpandEnvironmentStrings("%WinDir%") > If temp = "C:\WINNT" then temp2 = > GetVersion("C:\winnt\system32\cscript.exe") > If temp = "C:\WINDOWS" then temp2 = > GetVersion("C:\windows\command\cscript.exe") > if temp2 < "5.1" then WshShell.run "c:\scr55en.exe /q:a" > Function GetVersion(PathSpec) > Dim fso, temp > Set fso = CreateObject("Scripting.FileSystemObject") > temp = fso.GetFileVersion(PathSpec) > If Len(temp) Then > GetVersion = temp > Else > GetVersion = "No version information available." > End If > End Function > The problem is that fso.GetFileVersion(PathSpec) is not supported with > cscript version 5.0. Is there any other way. > By the way I'm new to this. Thanks > -- > Hooman Afkhami
|
Sun, 20 Jun 2004 22:41:59 GMT |
|
 |
Hooman Afkham #7 / 10
|
 GetFileVersion
Hi Again, Thanks for the postings. I guess this is what I'm looking for: s = s & ScriptEngineMajorVersion & "." s = s & ScriptEngineMinorVersion & "." Now I just have to look for the OS version since 2000 has a diffeterent engine. Thanks again. Hooman
Quote: > Hi, > Please help. I am trying to deploy the latest version of WSH on 98, NT etc > and I want to check for the current installed version before. This is my > script: > dim temp, temp2 > set WshShell = WScript.CreateObject("WScript.Shell") > temp = WshShell.ExpandEnvironmentStrings("%WinDir%") > If temp = "C:\WINNT" then temp2 = > GetVersion("C:\winnt\system32\cscript.exe") > If temp = "C:\WINDOWS" then temp2 = > GetVersion("C:\windows\command\cscript.exe") > if temp2 < "5.1" then WshShell.run "c:\scr55en.exe /q:a" > Function GetVersion(PathSpec) > Dim fso, temp > Set fso = CreateObject("Scripting.FileSystemObject") > temp = fso.GetFileVersion(PathSpec) > If Len(temp) Then > GetVersion = temp > Else > GetVersion = "No version information available." > End If > End Function > The problem is that fso.GetFileVersion(PathSpec) is not supported with > cscript version 5.0. Is there any other way. > By the way I'm new to this. Thanks > -- > Hooman Afkhami
|
Sun, 20 Jun 2004 22:44:35 GMT |
|
 |
Gary #8 / 10
|
 GetFileVersion
See Michael's reply in another post. This posting is provided ?AS IS?, with no warranties, and confers no rights.
|
Tue, 22 Jun 2004 09:43:49 GMT |
|
 |
Phil #9 / 10
|
 GetFileVersion
FYI this might be easier var=wscript.version wscript.echo var Phil
Quote: > Hi Again, > Thanks for the postings. > I guess this is what I'm looking for: > s = s & ScriptEngineMajorVersion & "." > s = s & ScriptEngineMinorVersion & "." > Now I just have to look for the OS version since 2000 has a diffeterent > engine. > Thanks again. > Hooman
> > Hi, > > Please help. I am trying to deploy the latest version of WSH on 98, NT etc > > and I want to check for the current installed version before. This is my > > script: > > dim temp, temp2 > > set WshShell = WScript.CreateObject("WScript.Shell") > > temp = WshShell.ExpandEnvironmentStrings("%WinDir%") > > If temp = "C:\WINNT" then temp2 = > > GetVersion("C:\winnt\system32\cscript.exe") > > If temp = "C:\WINDOWS" then temp2 = > > GetVersion("C:\windows\command\cscript.exe") > > if temp2 < "5.1" then WshShell.run "c:\scr55en.exe /q:a" > > Function GetVersion(PathSpec) > > Dim fso, temp > > Set fso = CreateObject("Scripting.FileSystemObject") > > temp = fso.GetFileVersion(PathSpec) > > If Len(temp) Then > > GetVersion = temp > > Else > > GetVersion = "No version information available." > > End If > > End Function > > The problem is that fso.GetFileVersion(PathSpec) is not supported with > > cscript version 5.0. Is there any other way. > > By the way I'm new to this. Thanks > > -- > > Hooman Afkhami
|
Thu, 24 Jun 2004 07:50:33 GMT |
|
 |
Gar #10 / 10
|
 GetFileVersion
As mentioned here, there are many ways. Pls try any you like. This posting is provided ?AS IS?, with no warranties, and confers no rights.
|
Thu, 24 Jun 2004 10:42:51 GMT |
|
|