Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Listing file versions

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 01-11-2007   #1 (permalink)
Jens Geyer
Guest


 

Listing file versions

A good $daytime to everybody,

I just tried to get a list of executables in a folder, together with
date, size and version number. The former ones are easy, while the last
one seems to be not-so-easy to me.

What I tried (one line):

PS> (gci a*.exe,a*.dll) | format-list -property
name,lastwritetime,length,fileversion

Ok, the fileversion is guessed (because of the fileversion member of
get-process) and as you see, it doesn't work:

Name : ALCMTR.EXE
LastWriteTime : 03.05.2005 18:43:28
Length : 69632

Name : ALCWZRD.EXE
LastWriteTime : 04.05.2006 16:26:36
Length : 2808832

But - how do I do it?
JensG

My System SpecsSystem Spec
Old 01-11-2007   #2 (permalink)
RichS
Guest


 

RE: Listing file versions

There was a similar question here

http://www.microsoft.com/communities...7-e9b330606bcc

From the answers given there you need to use the full path of the file

--
Richard Siddaway

Please note that all scripts are supplied "as is" and with no warranty


"Jens Geyer" wrote:

> A good $daytime to everybody,
>
> I just tried to get a list of executables in a folder, together with
> date, size and version number. The former ones are easy, while the last
> one seems to be not-so-easy to me.
>
> What I tried (one line):
>
> PS> (gci a*.exe,a*.dll) | format-list -property
> name,lastwritetime,length,fileversion
>
> Ok, the fileversion is guessed (because of the fileversion member of
> get-process) and as you see, it doesn't work:
>
> Name : ALCMTR.EXE
> LastWriteTime : 03.05.2005 18:43:28
> Length : 69632
>
> Name : ALCWZRD.EXE
> LastWriteTime : 04.05.2006 16:26:36
> Length : 2808832
>
> But - how do I do it?
> JensG
>

My System SpecsSystem Spec
Old 01-11-2007   #3 (permalink)
Jens Geyer
Guest


 

Re: Listing file versions

RichS schrieb:
> There was a similar question here
>
> http://www.microsoft.com/communities...7-e9b330606bcc
>
> From the answers given there you need to use the full path of the file
>


Great ... exactly what I needed.
Here's the solution for my case (one line):

PS> (gci *.exe,*.dll) | ft name,@{ label="Version"; expression = {(gcm
$_.fullname).FileVersionInfo.fileversion}},lastwritetime,length -autosize

which produces something like this:

Name Version LastWriteTime Length
---- ------- ------------- ------
ALCMTR.EXE 1.6.0.2 03.05.2005 18:43:28 69632
ALCWZRD.EXE 1.1.0.36 04.05.2006 16:26:36 2808832
DebugLog.exe 1.1.0.8 11.05.2006 14:05:45 551424
eraser.exe 08.07.1998 17:30:36 18944
explorer.exe 6.00.2900.2180 04.08.2004 14:00:00 1035264
FSC Message.exe 5,0,30,0 13.12.2001 16:45:52 665826
hh.exe 5.2.3790.2453 (s... 27.05.2005 01:22:01 10752
IsUn0407.exe 5, 51, 138, 0 17.11.1998 13:44:44 328704
IsUn0410.exe 5, 51, 138, 0 13.11.1998 13:07:12 307712
IsUninst.exe 5, 50, 137, 0 02.10.1998 20:00:48 327168
MicCal.exe 1.1.1.3 28.06.2006 14:00:40 2158592
NOTEPAD.EXE 5.1.2600.2180 (x... 04.08.2004 14:00:00 70144
NuNinst.exe 1, 2, 3, 93 22.07.2005 13:43:53 2973696


Maybe there's an even shorter way ... but it works.

Many thanks for the fast help!
JensG

My System SpecsSystem Spec
Old 01-11-2007   #4 (permalink)
Andrew Watt [MVP]
Guest


 

Re: Listing file versions

Richard,

For applications under X:\Windows the full path isn't needed. And
also a few other locations. The precise criteria aren't obvious to me.

For example, on my machine I don't need the path to pick up SQL Server
2005 applications using get-command.

Andrew Watt MVP

On Thu, 11 Jan 2007 02:37:01 -0800, RichS
<RichS@discussions.microsoft.com> wrote:

>There was a similar question here
>
>http://www.microsoft.com/communities...7-e9b330606bcc
>
>From the answers given there you need to use the full path of the file
>
>--
>Richard Siddaway
>
>Please note that all scripts are supplied "as is" and with no warranty
>
>
>"Jens Geyer" wrote:
>
>> A good $daytime to everybody,
>>
>> I just tried to get a list of executables in a folder, together with
>> date, size and version number. The former ones are easy, while the last
>> one seems to be not-so-easy to me.
>>
>> What I tried (one line):
>>
>> PS> (gci a*.exe,a*.dll) | format-list -property
>> name,lastwritetime,length,fileversion
>>
>> Ok, the fileversion is guessed (because of the fileversion member of
>> get-process) and as you see, it doesn't work:
>>
>> Name : ALCMTR.EXE
>> LastWriteTime : 03.05.2005 18:43:28
>> Length : 69632
>>
>> Name : ALCWZRD.EXE
>> LastWriteTime : 04.05.2006 16:26:36
>> Length : 2808832
>>
>> But - how do I do it?
>> JensG

My System SpecsSystem Spec
Old 01-11-2007   #5 (permalink)
Maximilian Hänel
Guest


 

Re: Listing file versions

Hi Andrew,

> For example, on my machine I don't need the path to pick up SQL Server
> 2005 applications using get-command.


That's AFAICS because SQL-Server Setup updates the path environment
variable - at least on my machine:

PS> $envath
[...]

cu

Max
My System SpecsSystem Spec
Old 01-11-2007   #6 (permalink)
Andrew Watt [MVP]
Guest


 

Re: Listing file versions

Thanks, Max.

That explains why I see Visual Studio applications too. Visual Studio
2005 updates the Path Environment Variable too.

it's beginning to make more sense now.

Andrew Watt MVP

On Thu, 11 Jan 2007 19:38:31 +0100, Maximilian Hänel <ngSpam@smjh.de>
wrote:

>Hi Andrew,
>
>> For example, on my machine I don't need the path to pick up SQL Server
>> 2005 applications using get-command.

>
>That's AFAICS because SQL-Server Setup updates the path environment
>variable - at least on my machine:
>
>PS> $envath
>[...]
>
>cu
>
>Max

My System SpecsSystem Spec
Old 01-12-2007   #7 (permalink)
Marcel J. Ortiz [MSFT]
Guest


 

Re: Listing file versions

Yes, get-command will only search the directories in the PATH environment
variable.


"Andrew Watt [MVP]" <SVGDeveloper@aol.com> wrote in message
news:lg3dq2dniand2i7i61aov73q27osd1h1dd@4ax.com...
> Thanks, Max.
>
> That explains why I see Visual Studio applications too. Visual Studio
> 2005 updates the Path Environment Variable too.
>
> it's beginning to make more sense now.
>
> Andrew Watt MVP
>
> On Thu, 11 Jan 2007 19:38:31 +0100, Maximilian Hänel <ngSpam@smjh.de>
> wrote:
>
>>Hi Andrew,
>>
>>> For example, on my machine I don't need the path to pick up SQL Server
>>> 2005 applications using get-command.

>>
>>That's AFAICS because SQL-Server Setup updates the path environment
>>variable - at least on my machine:
>>
>>PS> $envath
>>[...]
>>
>>cu
>>
>>Max



My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script to retrieve file versions tke402 VB Script 1 07-30-2008 12:50 PM
File versions Chester GS Vista General 3 03-03-2008 04:01 PM
Listing Directories in file Search Andy1974 PowerShell 2 02-07-2008 11:08 PM
Volume License File Versions Mike_K Vista General 21 11-20-2006 09:46 PM
Office 2003: File listing in Detail view doesn't work Dr. Network Vista General 0 10-06-2006 02:55 PM


Update your Vista Drivers Update Your Drivers Now!!

Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008