GetFileVersion 
Author Message
 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  
 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  
 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  
 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  
 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  
 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  
 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  
 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  
 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  
 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  
 
 [ 10 post ] 

 Relevant Pages 

1. Another DB2/2 problem?

2. Official Pascal Standards now at Pascal Central

3. Lock 1st column

4. memo field questions

5. GetFileVersion Question

6. GetFileVersion remotely?

7. GetFileVersion over a network???

8. GetFileVersion Method??????

9. GetFileVersion

10. GetFileVersion question?

11. File properties like getFileVersion ...

12. GetFileVersion Method??????

 

 
Powered by phpBB® Forum Software