Page 1 of 2 12>
Topic Options
#32960 - 2002-11-20 11:40 AM How to implement doing a 'dir' and executing al .exe files in it...
bpsysadmin Offline
Fresh Scripter

Registered: 2002-10-18
Posts: 20
Hi,

I'm making an hotfix script but it is stupid to put all hotfix.exe files in it manually.

So i want to do something like this:

Doing a 'dir' of X:\xpfixes and then executing all the .exe files in the X:\xpfixes directory.

Like if the filelisting of X:\xpfixes whould be:

q1.exe
q2.exe
q3.exe

then I want the script to start the q1.exe then the q2.exe and then the q3.exe

If I place another q in the directory like q4.exe
I want it to excecute too, next time the script starts..

(It's only this part I still need, the rest of the script is done. Just need the 'dir' thingy to work [Big Grin] )

hopefully you guys could help me out? [Smile]

Top
#32961 - 2002-11-20 11:50 AM Re: How to implement doing a 'dir' and executing al .exe files in it...
Vig Offline
Starting to like KiXtart

Registered: 2001-11-14
Posts: 166
Loc: Saudi Arabia
This is what I use in one of my scripts.

code:
		$Hot = Dir("%SYSTEMROOT%\TEMP\Hotfixes")
While $Hot <> ""
If InStr($Hot,".") <> 1
Shell '%comspec% /c %SYSTEMROOT%\TEMP\Hotfixes\$Hot /u /o /z /q'
EndIf
$Hot = Dir()
Loop


Top
#32962 - 2002-11-21 12:13 AM Re: How to implement doing a 'dir' and executing al .exe files in it...
bpsysadmin Offline
Fresh Scripter

Registered: 2002-10-18
Posts: 20
really much thanks! W0rks!
Top
#32963 - 2002-11-21 12:13 AM Re: How to implement doing a 'dir' and executing al .exe files in it...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
it's pretty well descriped in faq.
the first call initializes the dir() search and subsequent ones are continuing the same listing.

I wanted to do something nasty so here is my version:
code:
$explorer=createobject("shell.application")
$items=$explorer.namespace("X:\xpfiles").items

for each $item in $items
if $item.type = "application"
shell $item.path+' /u /o /z /q'
endif
next

_________________________
!

download KiXnet

Top
#32964 - 2002-11-20 02:59 PM Re: How to implement doing a 'dir' and executing al .exe files in it...
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Can I ask why you use -

Shell '%comspec%..

With Windows HotFixes they are all windows programs.. Qxxxxx.exe files, etc. you should be able to do -

RUN '%SYSTEMROOT%\TEMP\Hotfixes\$Hot /u /o /z /q'

Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#32965 - 2002-11-20 03:05 PM Re: How to implement doing a 'dir' and executing al .exe files in it...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
run?
no...
shouldn't those be installed one at a time?
_________________________
!

download KiXnet

Top
#32966 - 2002-11-20 03:26 PM Re: How to implement doing a 'dir' and executing al .exe files in it...
Vig Offline
Starting to like KiXtart

Registered: 2001-11-14
Posts: 166
Loc: Saudi Arabia
Force of habbit? Don't know, it's what I wrote a while back. I do agree that %COMSPEC% is unnecessary but I will have to stick with SHELL.
Top
#32967 - 2002-11-20 03:38 PM Re: How to implement doing a 'dir' and executing al .exe files in it...
bpsysadmin Offline
Fresh Scripter

Registered: 2002-10-18
Posts: 20
I Used it with the SHELL command, without COMSPEC [Smile] And yes, yo'all right: You must use SHELL and not RUN cause with RUN kix whouldnt wait until every hotfix is finished...but just starts them all [Big Grin]
Top
#32968 - 2002-11-20 03:40 PM Re: How to implement doing a 'dir' and executing al .exe files in it...
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
The use of DIR() is well documented in the KiXtart Manual.

Additionally, you should read ABC's of KiXtart board etiquette and message to new forum users and Cannot find what you are looking for? and DIR() Primer as both scripts and UDFs regarding DIR and hotfix installations have already been posted multiple times.

Please make the efford to take a look at the FAQ Forum since most of your questions are answered in it.

Finally, your script is conceptionally wrong since you're not checking whether a hotfix has already been installed and also does not check whether a hotfix must be installed separately.

[ 20. November 2002, 15:47: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#32969 - 2002-11-20 03:45 PM Re: How to implement doing a 'dir' and executing al .exe files in it...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
All this code seems a tad too simplistic and optimistic. Assuming the xpfixes folder may have late additions, I see no mechanism to ascertain which hotfixes have already been implemented and what is yet to be done. One would not want to apply all of them on every logon.

{edit}
OK... so now Jens revises his post rendering mine redundant. [Frown]

[ 20. November 2002, 15:48: Message edited by: LLigetfa ]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#32970 - 2002-11-20 03:48 PM Re: How to implement doing a 'dir' and executing al .exe files in it...
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
And the Hotfix install requires administrative privileges, too, and maybe even a reboot. I'd reboot anyway after applying hotfixes. Hotfixes are admin tasks and have no busineess being in a login script.
_________________________
There are two types of vessels, submarines and targets.

Top
#32971 - 2002-11-20 03:54 PM Re: How to implement doing a 'dir' and executing al .exe files in it...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Without actually testing any of that code, I wonder also about the order that the hotfixes are applied. Often there are prerequisites, and as Jens mentioned, some do require reboots.

It was an assumption on my part that this was to be in a logon script as there is no mention of it being an admin script.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#32972 - 2002-11-20 03:57 PM Re: How to implement doing a 'dir' and executing al .exe files in it...
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
QCHAIN.EXE is required if you install multiple hotfixes at the same time. This will somehow ensure that they are installed in the correct order.
_________________________
There are two types of vessels, submarines and targets.

Top
#32973 - 2002-11-20 04:50 PM Re: How to implement doing a 'dir' and executing al .exe files in it...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Gotta love how these thread run-on... [Confused]

All those assumptions and half-baked ideas... [Roll Eyes]

What would happen if we ran our networks that way? [Eek!]

The sad fact is that some do! [Frown]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#32974 - 2002-11-20 05:29 PM Re: How to implement doing a 'dir' and executing al .exe files in it...
Vig Offline
Starting to like KiXtart

Registered: 2001-11-14
Posts: 166
Loc: Saudi Arabia
quote:
Gotta love how these thread run-on...
No kidding...

I honestly believe some people only post to point out flaws in other peoples scripts and then make up stuff after that.

The subject of this post was "How to implement doing a 'dir' and executing al .exe files in it..."

At no time did it become about applying security patches, checking for security patches, installing patches with admin privledges.

I guess I really need to watch every single word in everything I post. I'm sorry bpsysadmin I should have known better than to leave the word "hotfix" in a post.

Some of you might as well put a link to ABC's of KiXtart board etiquette and message to new forum users in your sig as often as you use it in your messages.

I doubt I'd still be using Kixtart if I had received the welcome I see most new people getting these days.

If the shoe fits wear it...

Sorry, but thats just been building up[/RANT]

Top
#32975 - 2002-11-20 05:37 PM Re: How to implement doing a 'dir' and executing al .exe files in it...
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Vig:

The original post actually contains references to 'hotfix.exe', 'xpfixes', and 'q1.exe' (most likely abbreviation for quickfixes like q123456.exe).

We did provide solutions to the original problem. However, we also started pointing out shortcoming in the overall objective. I think it is valid to help him solve the underlying problem instead of just providing answers to the specific question and then have him knowingly script into a dead end. Essentially, his script would not work the way he conceptualized it.

Additionally, some research on this BBS would provide him with solutions to both the DIR problem and the 'how-to install hotfixes' problem.
_________________________
There are two types of vessels, submarines and targets.

Top
#32976 - 2002-11-20 06:27 PM Re: How to implement doing a 'dir' and executing al .exe files in it...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Vig,
I'm really sorry you feel that way. Granted, bpsysadmin did not ask for all this free advice but this is after all, a public forum. You do get what you pay for. We could simply provide a myopic answer and ignore the perceived flaws in the logic, but our training as SEs/SAs does not allow that.

I for one have never regretted asking a question because the answers were more than I bargained for.

If the realization that your first blush at a problem was a brain fart embarrases you, then perhaps a public forum isn't for you. Analysis of a half-baked idea should not be construed as a personal attack. I have been humbled several times on this board and am the better (IMHO, others may argue to the contrary) for it.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#32977 - 2002-11-20 06:45 PM Re: How to implement doing a 'dir' and executing al .exe files in it...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
One other point...

Engineers put their reputation and careers on the line every time they put their stamp on a document. It is sort of the same with us.

While the comments may appear to be directed only at the current thread participants, that is not the case. We recognize that a lot of people will encounter this thread through a search and may adopt the code (or advice) without any discussion.

There are a lot of things I did a year ago (heck, even last week) that I would do different today so a lot of the advice does not deserve immortality.

'nuf said... will get off my soapbox.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#32978 - 2002-11-21 07:16 AM Re: How to implement doing a 'dir' and executing al .exe files in it...
Vig Offline
Starting to like KiXtart

Registered: 2001-11-14
Posts: 166
Loc: Saudi Arabia
quote:
If the realization that your first blush at a problem was a brain fart embarrases you, then perhaps a public forum isn't for you. Analysis of a half-baked idea should not be construed as a personal attack.
I may have missed something but how should I be embarrased about my original post and how was it a half baked idea?

I showed an easy and yes a proper way to accomplish executing all .exe's in a directory (which is the subject of the post) and it seems to have worked for him. I fail to see your point.

Jens, your right he did mention hotfix in his post and I appoligize for raving like a mad man about that.

I'm not going to sit here and point out all of the unfounded assumptions made, that would serve little purpose I don't want to point any fingers. Some people just seem to be a bit "red pen" happy and often attempt to correct what was never asked.

This is not the proper place for this type of discussion so I ask any further comments be emailed.

Thanks,

ag4634@hotmail.com

Top
#32979 - 2002-11-21 02:41 PM Re: How to implement doing a 'dir' and executing al .exe files in it...
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
if you go over to scriptlogic, they have a queryhotfix script...

http://www.scriptlogic.com/kixtart/ViewFunction.asp?FN=QueryHotFix
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
Page 1 of 2 12>


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

Who's Online
0 registered and 778 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.085 seconds in which 0.033 seconds were spent on a total of 13 queries. Zlib compression enabled.

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