Version of file

(imported topic written by cstoneba)

What would be the best way to go about merging these two items into one?

if exists folder (value of variable “ProgramFiles” of environment & “\Citrix\PNAgent”) whose (exists file “wfica32.exe” of it) then version of file (value of variable “ProgramFiles” of environment & “\Citrix\PNAgent\wfica32.exe”) as string else “not installed”

and

if exists folder (value of variable “ProgramFiles” of environment & “\Citrix\ICA Client”) whose (exists file “wfica32.exe” of it) then version of file (value of variable “ProgramFiles” of environment & “\Citrix\ICA Client\wfica32.exe”) as string else “not installed”

thanks

(imported comment written by NoahSalzman)

Is this the question you want to solve: "Check that file A is there and, if it is, then check if file B is there. If file B is there return the version of B (and not A). If only file A exists return the version of A. If neither exists return “not installed.”

if exists file “c:\A.exe” then (if exists file “c:\B.exe” then version of file “c:\B.exe” as string else version of file “c:\A.exe” as string) else “not installed”

Noah

(imported comment written by jessewk)

Or possibly you want the highest version?

if (number of files (“c:\A.exe”; “c:\B.exe”) > 0 ) then ((maxima of versions of files (“c:\A.exe”; “c:\B.exe”)) as string) else “not installed”

(imported comment written by cstoneba)

noah’s summary was accurate. If A exists, then version of A. If B exists, then version of B. Else “Not installed”

(imported comment written by cstoneba)

Problem with this though. If PNAgent\ doesn’t exist, it ignores the rest of it (\ICA Client).

#1)

q: if exists file (value of variable “ProgramFiles” of environment & “\Citrix\PNAgent\wfica32.exe”) then (if exists file (value of variable “ProgramFiles” of environment & “\Citrix\ICA Client\wfica32.exe”) then version of file (value of variable “ProgramFiles” of environment & “\Citrix\ICA Client\wfica32.exe”) as string else version of file (value of variable “ProgramFiles” of environment & “\Citrix\PNAgent\wfica32.exe”) as string) else “not installed”

A: not installed

but this one works:

#2)

if (number of files (value of variable “ProgramFiles” of environment & “\Citrix\ICA Client\wfica32.exe”; value of variable “ProgramFiles” of environment & “\Citrix\PNAgent\wfica32.exe”) > 0 ) then ((maxima of versions of files (value of variable “ProgramFiles” of environment & “\Citrix\ICA Client\wfica32.exe”; value of variable “ProgramFiles” of environment & “\Citrix\PNAgent\wfica32.exe”)) as string) else “not installed”

My only thought is that if they both exists (PNagent and ICA client), #2 does not show both versions.

(imported comment written by NoahSalzman)

This will give you both versions separated by a comma if both versions exist. If only one of the file exists it will give you only one of the versions:

if (number of files (“c:\A.exe”; “c:\B.exe”) > 1) then (version of file “c:\A.exe” as string & ", " & version of file “c:\B.exe” as string) else (if (number of files (“c:\A.exe”; “c:\B.exe”) > 0) then (if exists file “c:\A.exe” then version of “c:\A.exe” else version of file “c:\B.exe”) else “not installed”)

(imported comment written by cstoneba)

so close…

q: if (number of files (value of variable “ProgramFiles” of environment & “\Citrix\ICA Client\wfica32.exe”); (value of variable “ProgramFiles” of environment & “\Citrix\PNAgent\wfica32.exe”) > 1) then (version of file (value of variable “ProgramFiles” of environment & “\Citrix\ICA Client\wfica32.exe”) as string & ", " & version of file (value of variable “ProgramFiles” of environment & “\Citrix\PNagent\wfica32.exe”) as string) else (if (number of files (value of variable “ProgramFiles” of environment & “\Citrix\ICA Client\wfica32.exe”); (value of variable “ProgramFiles” of environment & “\Citrix\PNAgent\wfica32.exe”) > 0) then (if exists file (value of variable “ProgramFiles” of environment & “\Citrix\ICA Client\wfica32.exe”) then version of (value of variable “ProgramFiles” of environment & “\Citrix\ICA Client\wfica32.exe”) else version of file (value of variable “ProgramFiles” of environment & “\Citrix\PNagent\wfica32.exe”)) else “not installed”)

E: The operator “less than” is not defined.

q: if (number of files (“c:\A.exe”; “c:\B.exe”) > 1) then (version of file “c:\A.exe” as string & ", " & version of file “c:\B.exe” as string) else (if (number of files (“c:\A.exe”; “c:\B.exe”) > 0) then (if exists file “c:\A.exe” then version of “c:\A.exe” else version of file “c:\B.exe”) else “not installed”)

A: 11.0.0.5357, 10.100.55836.0

(imported comment written by cstoneba)

Maybe there is an easier way to do this…

If there is a file called wfica32.exe somewhere under (value of variable “ProgramFiles” of environment & “\Citrix”) then version of it. ??

(imported comment written by NoahSalzman)

Aw, c’mon cstoneba… surely you could have said that at the start :wink:

if exists file A then version of file A else (if exists file B then version of file B else “not installed”)

(imported comment written by cstoneba)

Instead of specifiying the path to file A and file B and file C, can bigfix just search a folder (and all subfolders) for said file, then display the version(s)?

(imported comment written by jessewk)

versions of descendants whose (name of it = “foo”) of folders “c:\Temp”

But be very careful with this expression. It has the potential to walk your whole disk if you were to use just “c:”. That would be very expensive.

(imported comment written by cstoneba)

perfect! thanks jesse. If anyone else need this, the end solution was:

versions of descendants whose (name of it = “wfica32.exe”) of folders (value of variable “ProgramFiles” of environment & “\Citrix”)

(imported comment written by Shlomi91)

Hi guys,

i understand that there may be several Citrix clients installed on the same computer; i am only interested in the version of the client which opens the Citrix web interface published applications, which is located in the registry key “HKEY_CLASSES_ROOT\Applications\wfcrun32.exe\shell\open\command”.

my problems are as follows:

  1. the said registry key shows the resault as "“C:\Program Files\Citrix\ICA Client\wfcrun32.exe” “%1"”; how can i remove the “%1” part?

    q: value “” of key “HKEY_CLASSES_ROOT\Applications\wfcrun32.exe\shell\open\command” of registry
    A: “C:\Program Files\Citrix\ICA Client\wfcrun32.exe” “%251”

  2. using the combined solution from Jessewk and cstobeba, (or another solution), how can i find the version of the file in #1?

thanks,

Shlomi