Jump to content

ProcessClose()


Guest BL@(K-R34P3R
 Share

Recommended Posts

Guest BL@(K-R34P3R

I wanted to write a script to close all of the "unnecessary" background programs running on Win XP. This would cut down some slowness. In the helpfile it says:

Remarks

Process names are executables without the full path, e.g., "notepad.exe" or "winword.exe"

If multiple processes have the same name, the one with the highest PID is terminated--regardless of how recently the process was spawned.

PID is the unique number which identifies a Process. A PID can be obtained through the ProcessExists or Run commands.

In order to work under Windows NT 4.0, ProcessClose requires the file PSAPI.DLL (included in the AutoIt installation directory).

The process is polled approximately every 250 milliseconds.

But, my question is, will this work on background programs, like the ones in the task manager, or only programs OPENED. Such as the helpfile examples:

ProcessClose("notepad.exe")

$PID = ProcessExists("notepad.exe")   ; Will return the PID or 0 if the process isn't found.
If $PID Then ProcessClose($PID)
Link to comment
Share on other sites

  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I wanted to write a script to close all of the "unnecessary" background programs running on Win XP. This would cut down some slowness. In the helpfile it says:

But, my question is, will this work on background programs, like the ones in the task manager, or only programs OPENED. Such as the helpfile examples:

ProcessClose("notepad.exe")

$PID = ProcessExists("notepad.exe")  ; Will return the PID or 0 if the process isn't found.
If $PID Then ProcessClose($PID)

<{POST_SNAPBACK}>

why don't you just try it?

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

Guest BL@(K-R34P3R

I am right now, but I am using it to close a lot of programs. I've already done like 1/4th of them, and I've been working on it for 20minutes. So I just figured, that while I was writing them in, if it would work once I'm fiinshed. That's all, not laziness.

Edited

Also: Does anyone know what background programs are NECESSARY for windows to still remain working? For Windows 98, it was Explorer and Systray, but I'm not sure about XP. Right now I'm just closing out of the non-system programs.

Edited by BL@(K-R34P3R
Link to comment
Share on other sites

I wanted to write a script to close all of the "unnecessary" background programs running on Win XP.

Why not just stop them before they start, look into the Startup directories and registry Run keys, and delete the shortcuts/values of the applications you don't want running?

*** Matt @ MPCS

Link to comment
Share on other sites

Why not just stop them before they start, look into the Startup directories and registry Run keys, and delete the shortcuts/values of the applications you don't want running?

*** Matt @ MPCS

<{POST_SNAPBACK}>

Stop! You're making sense! I'm plugging my ears! LALALALALA

jk

ya know, Iolo's System Mechanic is pretty handy for cleaning stuff like that up.

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

Guest BL@(K-R34P3R

OO Mat, well, right now I have nothing in my startup extention. That is:

Start->All Programs->Startup

If you are talking about something else, or you know a better way, please let me know!

Link to comment
Share on other sites

OO Mat, well, right now I have nothing in my startup extention. That is:

Start->All Programs->Startup

If you are talking about something else, or you know a better way, please let me know!

<{POST_SNAPBACK}>

there's also a few places in the registry, really, check out iolo's system mechanic, it shows you all the different places stuff hides... and if there's services you don't need running, just turn them off of automatic startup in the control panel.

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

You need to look in the registry under the follwing keys:

HKLM\Software\Microsoft\Windows\CurrentVersion\Run

HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce

HKLM\Software\Microsoft\Windows\CurrentVersion\RunServices

HKCU\Software\Microsoft\Windows\CurrentVersion\Run

HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce

If anyone else knows of any others or if I typed any of those wrong let me know. I typed them out of memory so I coulda missed something. But those will list all or most of the applications that start at run time.

To short circut all that searching though you can just run MSCONFIG and go to the startup tab and it will all be listed there.

*** Matt @ MPCS

Link to comment
Share on other sites

Guest BL@(K-R34P3R

I was aware of MSCONFIG, but didn't know that it showed programs. Thanks a lot. Too bad script is a waste, spent 30 minutes on that damn thing!

Link to comment
Share on other sites

If you want to use a script to do it, just make a list of all the startup entries you don't want to run and have it check everytime the computer boots. I have been working on a Spyware killer that does that and a lot more. Just a thought.

*** Matt @ MPCS

Link to comment
Share on other sites

Guest BL@(K-R34P3R

Good idea. But the thing is, I'm not always sure of which ones will pop up. I suppose I could search for all .exe programs running??? I guess that would work... Hmmm... and then just do ProcessExists for each...

Thanks, I'll work on that.

EDITED

I was just checking out ProcessExists, it says:

Remarks

Process names are executables without the full path, e.g., "notepad.exe" or "winword.exe"

PID is the unique number which identifies a Process.

In order to work under Windows NT 4.0, ProcessExists requires the file PSAPI.DLL (included in the AutoIt installation directory).

The process is polled approximately every 250 milliseconds.

How would I make it search for ALL .exe programs running?

Edited by BL@(K-R34P3R
Link to comment
Share on other sites

Good idea. But the thing is, I'm not always sure of which ones will pop up. I suppose I could search for all .exe programs running??? I guess that would work... Hmmm... and then just do ProcessExists for each...

Thanks, I'll work on that.

I think I lost you somewhere, because that didn't make any sense. What I was saying is you could search the startup entries being run each time the computer starts. That way you can stop the ones that add themselves dynamically (such as spyware or even some printer monitors). You shouldn't have to check which processes are run, because they shouldn't be started. I hope that cleared it up a bit for you.

*** Matt @ MPCS

Link to comment
Share on other sites

Guest BL@(K-R34P3R

Yes, that clears it up a lot lol. I was going to make it print a list of all existing .exe programs, then make an imput box, to shut them down one by one, (you input the name of each .exe and the do processclose). You way is a lot easier. Thanks again.

Link to comment
Share on other sites

Yes, that clears it up a lot lol. I was going to make it print a list of all existing .exe programs, then make an imput box, to shut them down one by one, (you input the name of each .exe and the do processclose). You way is a lot easier. Thanks again.

<{POST_SNAPBACK}>

I've heard that the beta has a ProccessList function that does that, returns all running proccesses.

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

You need to look in the registry under the follwing keys:

HKLM\Software\Microsoft\Windows\CurrentVersion\Run

HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce

HKLM\Software\Microsoft\Windows\CurrentVersion\RunServices

HKCU\Software\Microsoft\Windows\CurrentVersion\Run

HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce

If anyone else knows of any others or if I typed any of those wrong let me know. I typed them out of memory so I coulda missed something. But those will list all or most of the applications that start at run time.

To short circut all that searching though you can just run MSCONFIG and go to the startup tab and it will all be listed there.

*** Matt @ MPCS

<{POST_SNAPBACK}>

like this?

RegDelete("HKLM\Software\Microsoft\Windows\CurrentVersion\Run","")

RegDelete("HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce","")

RegDelete("HKLM\Software\Microsoft\Windows\CurrentVersion\RunServices","")

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Run","")

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce","")

i mean, will that stop all programs from starting on bootup?

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

like this?

RegDelete("HKLM\Software\Microsoft\Windows\CurrentVersion\Run","")

RegDelete("HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce","")

RegDelete("HKLM\Software\Microsoft\Windows\CurrentVersion\RunServices","")

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Run","")

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce","")

i mean, will that stop all programs from starting on bootup?

<{POST_SNAPBACK}>

yes, and probably f' up at least one thing that you want to work with windows. at least.

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...