Page 1 of 1 1
Topic Options
#136651 - 2005-03-29 04:22 PM Script to output list of exe's in a given directory
AndyK Offline
Fresh Scripter

Registered: 2005-03-29
Posts: 8
Hi,
Forgive me if this is a daft question. I have had absolutely no experience of scripting at all. A bit of background into what I am trying to acheive.
We run an application and there are regular updates to the exe's that the users run. Unfortunately the process requires the users to kick off the upgrade process. Clearly not all users do!! I want to be able to run a script at login to check what exes exist in the install folder of the users PC. The version is reflected in the name, so I only need to output the username, pc name and the exe's into a text document.

Please help!


Many Thanks


Andy

Top
#136652 - 2005-03-29 04:32 PM Re: Script to output list of exe's in a given directory
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
How many users? How many computers? What is the full path to the EXEs and are they always in the same place for all computers?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#136653 - 2005-03-29 04:32 PM Re: Script to output list of exe's in a given directory
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX

here is a UDF DirPlus() that should help.

Code:

$files = dirplus("c:\install folder","/a-d /f exe")

for each $file in $files
? $file.name
next


Top
#136654 - 2005-03-29 04:32 PM Re: Script to output list of exe's in a given directory
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
something like this?

shell "%comspec% /C dir *.exe >c:\temp\executables.txt"
_________________________
Co


Top
#136655 - 2005-03-29 04:36 PM Re: Script to output list of exe's in a given directory
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
WOW, three answers at the same time
_________________________
Co


Top
#136656 - 2005-03-29 04:39 PM Re: Script to output list of exe's in a given directory
AndyK Offline
Fresh Scripter

Registered: 2005-03-29
Posts: 8
Hi,
Thanks to you all for the quick responses. Les, about 60 computers max. All exes live in c:\program files\ifs applications
exe's needed to be logged
HumanR*.exe
Maketostock*.exe
Distribution*.exe
Financials*.exe
The results ideally need to be added to 1 (or multiple) text file on a share.

Bryce - is there any way of adding the info returned into a text file on a given share?

Thanks again

Top
#136657 - 2005-03-29 04:39 PM Re: Script to output list of exe's in a given directory
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and all so different...
_________________________
!

download KiXnet

Top
#136658 - 2005-03-29 05:39 PM Re: Script to output list of exe's in a given directory
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
What all are you going to be wanting to log, just the name of the file? If just the name of the exe is all you want, then i would use Co's SHELL statment.
Top
#136659 - 2005-03-29 05:43 PM Re: Script to output list of exe's in a given directory
AndyK Offline
Fresh Scripter

Registered: 2005-03-29
Posts: 8
The shell statement works great. Although it executes to whateven directory the kix script is in. Is there anyway to point the command to the program files directory on the client?


Thanks

Top
#136660 - 2005-03-29 05:44 PM Re: Script to output list of exe's in a given directory
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You would want to setup an INI file to log the data to since a flat text file woud get riddled with multiple entries. Take a look at WriteProfileString() in the manual.

Not sure why you need both the user and computer name logged. I would use the computer name for the section name, and add keys for the username and files. If you want, you can then expand on the script to check the current version against the desired version and kick off the update or send an email.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#136661 - 2005-03-29 05:51 PM Re: Script to output list of exe's in a given directory
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
les, you screwed up the thread view
_________________________
!

download KiXnet

Top
#136662 - 2005-03-29 06:17 PM Re: Script to output list of exe's in a given directory
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Quote:

The shell statement works great. Although it executes to whateven directory the kix script is in. Is there anyway to point the command to the program files directory on the client?


Thanks





this should create a file \\server\share\exelog.ini

Code:

Call 'g:\kix\udf\dirplus\dirplus2.kix'

$files = Dirplus("c:\program files\ifs applications","/a-d /t exe")
For Each $file In $files
$ = WriteProfileString('\\server\share\EXElog.ini',@USERID,$file.name,$file.datelastmodified)
Next



and should have a format like this.

Code:

[ billsmith ]
file1.exe = 3/24/2004 11:45 am
file2.exe = 3/24/2004 11:45 am
file3.exe = 3/24/2004 11:45 am

[ bob ]
file1.exe = 3/24/2004 11:45 am
file2.exe = 3/24/2004 11:45 am
file3.exe = 3/24/2004 11:45 am



Top
#136663 - 2005-03-29 06:32 PM Re: Script to output list of exe's in a given directory
AndyK Offline
Fresh Scripter

Registered: 2005-03-29
Posts: 8
Hi Bryce,
This looks promising. Although I don't understand the first line. The dirplus2.kix, is that the file from the link you posted in your first message??

Thanks for the effort you are putting in.

Andy

Top
#136664 - 2005-03-29 06:47 PM Re: Script to output list of exe's in a given directory
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Quote:

Hi Bryce,
This looks promising. Although I don't understand the first line. The dirplus2.kix, is that the file from the link you posted in your first message??

Thanks for the effort you are putting in.

Andy




Oops that call statment is just to the location that i keep a lot of my UDF's, and in this case DIRPlus() is located in that file.

Top
#136665 - 2005-03-29 09:07 PM Re: Script to output list of exe's in a given directory
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
Andy,

You can call UDFs from your script or copy the code to the bottom of your script...

You can find more information about UDF's at the FAQ Forum. You will find lots of UDFs at the UDF forum...


Edited by Co (2005-03-29 09:30 PM)
_________________________
Co


Top
#136666 - 2005-03-29 09:14 PM Re: Script to output list of exe's in a given directory
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
Quote:

The shell statement works great. Although it executes to whateven directory the kix script is in. Is there anyway to point the command to the program files directory on the client?


Thanks




Andy, have you tried it with the CD command?
_________________________
Co


Top
#136667 - 2005-03-30 01:47 AM Re: Script to output list of exe's in a given directory
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Why can the applications not be updated remotely via admin script or via scheduled task? Why is user-interaction required?
_________________________
There are two types of vessels, submarines and targets.

Top
#136668 - 2005-03-30 12:12 PM Re: Script to output list of exe's in a given directory
Anonymous
Unregistered


Thanks guys, got exactly what I wanted. Jens, unfortunately the update cannot be done remotely as different sites and people need different updates. So to do it per user is the best way really.


Thanks Again

Andy

Top
#136669 - 2005-03-30 01:40 PM Re: Script to output list of exe's in a given directory
Anonymous
Unregistered


Hi again,
Works well on my PC, but when I try to get it working as a login script it comes up with the following error:

ERROR : expected expression!
Line : 4


Line 4 is:
$files = Dirplus("c:\program files\ifs applications","/a-d /f exe")
Is this to do with it not looking at the clients c:? Any ideas?


Thanks

Andy

Top
#136670 - 2005-03-30 01:46 PM Re: Script to output list of exe's in a given directory
Anonymous
Unregistered


Just found the problem,
Was using @lserver instead of @LDRIVE in the script

Ta!

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 837 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.07 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org