Question Locked

script to list program versions

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello I am trying to produce a script that outputs all the file verion and date info for a filetype in a mapped drive on a shared directiory. The script I have works locally but fails on the mapped drive

here it is any hints?

Option Explicit
Dim fso, fc, f, fs
Dim strPath, strFile

'On Error Resume Next

strPath = "C:\Documents and Settings\profilename\desktop\exes.txt"

Set fso = CreateObject("Scripting.FileSystemObject")

Set strFile = fso.CreateTextFile(strPath, True)

strFile.WriteLine("FileName,Last Modified,File Version")

Set f = fso.GetFolder("D:\Program Files\winLAME")
Set fc = f.Files
For Each fs In fc
If fso.GetExtensionName(fs) = "exe" then
strFile.WriteLine(fs.Name & "," & fs.DateLastModified & "," & fso.GetFileVersion(fs))
End if
Next

2 replies

by slayer_

The part of the FSO object that tells it to actually writes its buffer to the fole, you also need to close the file.
I rarely use FSO so I am not entirely sure of the command. I asume you are writing this in VBS?

Also I could be wrong but I think you can do this easily in a DOS batch file.

Enter a command

dir C:\*.exe /S > C:\Output.txt

This will output Date/time and filename and size to a file called output.txt on the root of your drive.

This discussion is closed to new replies.