Bookmark and Share

Author Topic: shutdown specific Windows XP process(es)  (Read 18470 times)

0 Members and 1 Guest are viewing this topic.

CurlySue

  • Guest
shutdown specific Windows XP process(es)
« on: June 13, 2009, 01:00:23 AM »
Hi Shane!

I have been using CleanMem 1.4.1 for about a week and am very pleased with the results, and now I see that you have updated it to 1.4.2 - very nice.

I have been looking for a program similar to your Simple Shutdown Timer for use with copying VHS tapes to my PC HDD. The application involves setting a timer to shutdown the specific process, in this case, One Touch Video Capture.

In short, when copying a 2 to 6 hour VHS tape, it would be nice to be able to walk away from my PC knowing that after a specified period of time, it would terminate the One Touch Video Capture process automatically. This is something that the One Touch Video Capture software fails to do. As a result, when the VHS tape ends (and the VCR rewinds), the HDD continues to record (static) and use up GBs of storage space. If I were not present, the process would use up all available space on my HDD.

I have looked at other programs that shutdown Windows XP process(es), but they rarely have timers and those that do, do not exceed 60 minutes.

I recognize that your Simple Shutdown Timer would shut my PC down after a specific period of time, but it may negatively effect my HDD and that is something I prefer to avoid.

Any thoughts or recommendations are sincerely welcomed.

Thanks again!!

CurlySue :o)

PcWinTech.com Forums

shutdown specific Windows XP process(es)
« on: June 13, 2009, 01:00:23 AM »

Offline Shane

  • Top Geek, err uh Dog.
  • PcWinTech Administrator
  • PcWinTech Guru
  • *******
  • Join Date: Jul 2008
  • Posts: 16,846
  • Location: USA
  • Karma: 523
  • "Knowledge should be shared not hidden."
I dont think it would hurt
« Reply #1 on: June 13, 2009, 08:23:25 AM »
I dont think it would hurt your hard drive any, its just the process of Windows shutting down, which closes all the programs. The next 2 weeks I am slammed getting some other work done, but if you remind me later it shouldn't take me more than a few hours to put a program together for you that has the timer like simple shutdown timer and will end task on a program.

-Shane
(My weekends belong to my wife and kids, I will try my best to answer all posts daily during the work week)

(About Shane)
Site Owner, Top Admin, Lead Programmer, Wife & 5 kids, Needs a lot more coffee.

When people ask "Why fix what isn't broken?" I reply "To make it better."
"Only a life lived for others is a life worthwhile"
Honor & Respect is all that matters.

Owner & Programmer of: www.pcwintech.com & www.tweaking.com

CurlySue

  • Guest
What a WONDERFUL reply!
« Reply #2 on: June 13, 2009, 10:53:52 PM »
What a WONDERFUL reply!  :o)

Thank you for sharing your knowledge regarding Windows shutdown process and my HDD concerns.

Moreover, I sincerely appreciate your offer to create a program together that has the timer to end specific task on a program.  Ending process(es) that are identified or listed in Windows Task Manager, in my case, at this time, specifically, the process that I will select will be One Touch Video Capture.  

I am in no rush, Shane, as I have been looking for a solution for a couple of weeks thus far.  So, a couple more (or longer) is not an issue.  

I will be happy to post again in a couple of weeks.

Till then, thank you so very much Shane!!

With kindest regards,

CurlySue  :o)

Offline Shane

  • Top Geek, err uh Dog.
  • PcWinTech Administrator
  • PcWinTech Guru
  • *******
  • Join Date: Jul 2008
  • Posts: 16,846
  • Location: USA
  • Karma: 523
  • "Knowledge should be shared not hidden."
I should have thought of this
« Reply #3 on: June 14, 2009, 08:16:23 PM »
I should have thought of this before, you don't need a program to do what you want. You can use Windows.

Let me explain what to do.
Windows has a task kill command. We put the command into a bat file, then use the windows task scheduler on when to run the bat file. There you go, you got what you need.

So lets do this. Open notepad, in notepad put in

taskkill /IM sidebar.exe /f

change sidebar.exe to what ever the name of the exe is of the program you want to close.
You can add as many lines as you need if you need to kill more than one task.
Save the file as a bat file, so save it as close.bat or something.

Now go to the start menu, all programs, accessories, system tools and then Scheduled Tasks.
Now create a new schedule and set the bat file and what time to run the bat.

That should get you by, and then in a couple weeks when I have time I can make the program if you still need it.

Shane
(My weekends belong to my wife and kids, I will try my best to answer all posts daily during the work week)

(About Shane)
Site Owner, Top Admin, Lead Programmer, Wife & 5 kids, Needs a lot more coffee.

When people ask "Why fix what isn't broken?" I reply "To make it better."
"Only a life lived for others is a life worthwhile"
Honor & Respect is all that matters.

Owner & Programmer of: www.pcwintech.com & www.tweaking.com

CurlySue

  • Guest
see reply above
« Reply #4 on: June 15, 2009, 07:19:58 AM »
see reply above

CurlySue

  • Guest
First, I want to thank you
« Reply #5 on: June 15, 2009, 07:25:23 AM »
First, I want to thank you again for replying to my posting.  :o)

I tried your recommendation and it did not work.  As a result, I chose to investigate further where I discovered that Windows XP does not include the TASKKILL program - it appears to be available for Vista users, however, I have no interest in Vista at this time.

Next, a Google search or two produced a hit that detailed a Windows XP program called TSKILL and I found it in my C:Windows\system32 directory.  Then, I opened a CMD window to review the syntax, where I found...

C:\>tskill /?
Ends a process.
TSKILL processid | processname [/SERVER:servername] [/ID:sessionid | /A] [/V]
  processid           Process ID for the process to be terminated.
  processname         Process name to be terminated.
  /SERVER:servername  Server containing processID (default is current).
                         /ID or /A must be specified when using processname
                         and /SERVER
  /ID:sessionid       End process running under the specified session.
  /A                  End process running under ALL sessions.
  /V                  Display information about actions being performed.
C:\>

After opening Windows Task Manager:


- under the Processes tab, I found the PID and Image Name [aka the Process that I wish to end or terminate], and therefore knew what to type in for
"processid" and "processname" but was not sure if the | character was required.

- under the Users tab, I found User, ID, Status, Client Name, and Session, but they are all blank and therefore could not determine what to type in for [/SERVER:servername] [/ID:sessionid | (again not knowing if this | character was required) but felt that the /A was the appropriate switch to use.  

Given the unknowns described above, I tried the following batch file commands...

TSKILL 2476 | sidebar.exe | /A
- where sidebar.exe was the Image Name of the exe of the program I wanted to close.  After a brief screen flash, it did not work.

TSKILL 2476 | sidebar | /A
- did not work.

TSKILL 2476 sidebar.exe /A
- did not work.

TSKILL 2476 sidebar /A
- did not work.

TSKILL 2476 /A
- did not work.

TSKILL 2476
- did not work.

TSKILL sidebar.exe
- did not work.

TSKILL sidebar
- did not work.

TSKILL "C:\Program Files\sidebar.exe"
- did not work.

TSKILL "C:\Program Files\sidebar"
- did not work.

Since I am a Windows XP Home Edition user, while I do have the LanmanServer service [aka Server] fully enabled to startup automatically, I am not on a Server and that may be why, Windows Task Manager / Users tab, User, ID, Status, Client Name, and Session display no information. And, while I do not know if this | character is required, it appears that the [/SERVER:servername] [/ID:sessionid may be required to make TSKILL work properly.

Using the 'Help and Support' option in Windows XP, I searched the term "servername" and read about Mapping Network Drives.  While this may be relevant, as a stand alone PC user, it confuses me and therefore I chose not to investigate it further.  

I shall continue to investigate the TSKILL program, but, for now I am out of ideas.

Thanks again, Shane!!

CurlySue

P.S.  I also do not have TASKLIST and (referring to http://www.microsoft.com/downloads/details.aspx?FamilyId=49AE8576-9BB9-4126-9761-BA8011FABF38&displaylang=en) it appears that it is not a Windows XP SP2 program.

P.S.S.  Sadly, after several trials, it also appears that TSKILL is totally ineffective at ending any process.  This is quite puzzling given the additional education I discovered at http://commandwindows.com/taskkill.htm

UPDATE
Well, I found a reference to TSKILL which lead me to believe that I needed to enable Terminal Services.  After setting TermService to manual and starting the service, I ran "TSKILL sidebar" (without quotes) and it WORKED!  

At this point, I am not comfortable with the Schedule (and) or TermService service(s) running when I do not require TSKILL.  To resolve this, I created a batch file to enable them both prior to running requiring TSKILL to shutdown "sidebar" (One Touch Video Capture, in this case)...

startTERMSERVICE.bat
------------------------------------
sc config Schedule start= demand
sc start Schedule
sc config TermService start= demand
sc start TermService
cls

Next, I revised the batch file that executes TSKILL to stop both Schedule and or TermService services as follows...

closeSIDEBAR.bat
----------------------------
TSKILL sidebar
sc stop TermService
sc config TermService start= disabled
sc stop Schedule
cls

Last, at the conclusion of adding the Scheduled Task (One time only), I check the box to 'Open advance properties...' and under the Settings tab I check 'Delete the task if it is not scheduled to run again' and uncheck 'Stop the task...' and click OK.

While this method is a bit cumbersome, it appears to work properly and that is GREAT for me!!  A program that achieves the same would be nice, but I am happy to use this method since it works and satisfies my objective.

That's my update for now, Shane!

Thanks again!!

CurlySue

Offline Shane

  • Top Geek, err uh Dog.
  • PcWinTech Administrator
  • PcWinTech Guru
  • *******
  • Join Date: Jul 2008
  • Posts: 16,846
  • Location: USA
  • Karma: 523
  • "Knowledge should be shared not hidden."
Glad to here you got it
« Reply #6 on: June 15, 2009, 08:19:00 AM »
Glad to here you got it working! Im on XP pro and it has taskkill, they must have removed it from home. Its great to know its tied to the terminal services service.

Once you have all the bat files made, when you go create the job go to C:\Windows Tasks and copy the job to your desktop. this way when you need put the job back in you can copy it back then just change the run time. that should save you some work. Its how my cleanmem installs its job.

If you ever need anything else just let me know :-)
Shane
(My weekends belong to my wife and kids, I will try my best to answer all posts daily during the work week)

(About Shane)
Site Owner, Top Admin, Lead Programmer, Wife & 5 kids, Needs a lot more coffee.

When people ask "Why fix what isn't broken?" I reply "To make it better."
"Only a life lived for others is a life worthwhile"
Honor & Respect is all that matters.

Owner & Programmer of: www.pcwintech.com & www.tweaking.com

CurlySue

  • Guest
I shall. :o) Many
« Reply #7 on: June 15, 2009, 10:07:41 AM »
I shall.  :o)

Many thanks!!!

CurlySue

Ron

  • Guest
end hung task after N seconds
« Reply #8 on: June 18, 2009, 11:36:31 AM »
Shane,
I would be interested in basically the same kind of program. We have a scheduled process that runs every 5 minutes. About 5% of the time the program hangs. I would like to have another process that tat is running that watched for process "A" to start and keeps trak of how long it has been running. If it is more than N seconds it terminates process "A" and continutes to watch.


Any help would be greatly appreciated.

Thanks
Ron

Offline Shane

  • Top Geek, err uh Dog.
  • PcWinTech Administrator
  • PcWinTech Guru
  • *******
  • Join Date: Jul 2008
  • Posts: 16,846
  • Location: USA
  • Karma: 523
  • "Knowledge should be shared not hidden."
hhhmmm... I could make a
« Reply #9 on: June 18, 2009, 11:46:44 AM »
hhhmmm...
I could make a program that runs in the system tray. every 10 sec or so loads a list of the current running processes. When it sees the process it is looking for it saves the time it found it. After a certain amount of time has passed (5 min) and the program still shows up in the list the program will kill it. Then clear the time it found it and start watching for it again.

That wouldn't be to hard for me to do. Im going to be gone this weekend (Fathers day, I will have my laptop to stay up with the site thought) so I wont be able to make it this weekend. Maybe if I get board though I can program it. lol

Let me see what I can get by next week. If you don't hear from me drop me another line.

Shane
(My weekends belong to my wife and kids, I will try my best to answer all posts daily during the work week)

(About Shane)
Site Owner, Top Admin, Lead Programmer, Wife & 5 kids, Needs a lot more coffee.

When people ask "Why fix what isn't broken?" I reply "To make it better."
"Only a life lived for others is a life worthwhile"
Honor & Respect is all that matters.

Owner & Programmer of: www.pcwintech.com & www.tweaking.com

PcWinTech.com Forums

hhhmmm... I could make a
« Reply #9 on: June 18, 2009, 11:46:44 AM »