Search the Community
Showing results for tags 'processclose'.
-
Hi, I'm using vpn connection to a remote computer with a login user (idk if that's any important). I want to loop a process until it's closed completely. I'm just looping until the process is closed (for or while doesn't matter): Local $aProcessList = ProcessList("cmd.exe") For $i = 1 To $aProcessList[0][0] ConsoleWrite("PID: " & $aProcessList[$i][1] & @CRLF) ProcessClose($aProcessList[$i][0]) ;WinKill($aProcessList[$i][0]) If @error Then ConsoleWrite("Error is: " & @error & @CRLF) EndIf Next This is my output: PID: 5548 Error is: 2 PID: 29488 Error is: 2 PID: 47248 Error is: 2 When I check in the task manager, I can only see one cmd --> 47248: 1. But my script doesn't close this process. I checked the error code 2 (AdjustTokenPrivileges Failed), but couldn't go any further. 2. I cannot see other two cmd.exe (5548 + 29488) in the task manager either even if I click "show process from all users". 3. If I select 47248 manually click on "end process", it works, the process is closed. I put #RequireAdmin in the beginning (hoping), but that didn't work either. If there are other processes from other users, I don't want to terminate them. I only want to terminate the process that is under my user. If I just type ProcessClose(47248) in my script, then it closes. But I couldn't close it inside the loop. What am I missing?
-
Hello All, If you're interested in the story, read below. Otherwise, just jump to the end of the post. Story: Sometimes my computer goes crazy with Windows update. I tried to turn it off with "services.msc", but couldn't close the it. So, I did some research online that it's triggered by Update Orchestration and Task Scheduler and Windows Update. I also checked that all three processes are triggered by svchost.exe. So, I tried to make a script to close this process. I found some useful functions ProcessList and _ProcessGetName using the help documents and coded something as below: #include <MsgBoxConstants.au3> #include <Process.au3> Local $aProcessList = ProcessList() For $i = 1 To $aProcessList[0][0] $iPid = $aProcessList[$i][1] $sName = _ProcessGetName($iPid) MsgBox($MB_SYSTEMMODAL, "The process", "PID: " & $iPid & @CRLF & "NAME: " & $sName) If $sName = "svchost.exe" Then ;ProcessClose($iPid) ;I don't know if this is the process I want to close EndIf Next But the problem is; there are so many svchost.exe exists in the process list. I can't close all of them, some of them are essential to run Windows (well, accidentally I terminated some of them and ended up with a blue screen --------------- Well, how can I know the process name like "Service Host: Update Orchestration" (not the scvhost)? It's not only with the .exe file, just to the name shown in Windows.
- 14 replies
-
- windows 10
- process name
-
(and 1 more)
Tagged with:
-
Speed Up ProcessWait/ProcessClose Polling?
DrLarch posted a topic in AutoIt General Help and Support
According to the help file: "The process is polled approximately every 250 milliseconds." I've got a process I am watching for and need to kill as fast possible. There appears to be no way to configure the poll time that I can see. Does anyone know any other way of accomplishing this? I don't care about nailing the CPU's, since it's just going to be for a relatively short period (I have a rough idea of when the process starts). Any direction/ideas appreciated. -
Guys, I really need your help. I am having a problem on the "processclose" on Windows 2008 R2. The code below is working great on Windows 7 but not on the Windows 2008 Basically, the extract.exe is open or run by cmd.exe, after certain period of time the extract.exe will exit (automatically), then after 5sec the cmd will exit, followed by a message " File extracted" which will close after 5sec.. $PID_Check=ProcessWaitClose("extract.exe"); Pause script execution until the given process does not exist if $PID_Check = 1 Then ;1= not exist Sleep(5000) ProcessClose("cmd.exe") Sleep(3000) MsgBox(0, "", "File extracted",5); message box will close after 5sec EndIf I can't figure out what the problem is, I tried on Window 7 but no problems. I'm on domain and I'm using the same username and I able to run the code.. Is there any other code I can use to close the cmd exe. if the cmd.exe did not close, on the next run it will not execute the extract.exe since the cmd.exe is still running. This is unattended run using task scheduler. Thank you very much.