Windows XP Community - XPHeads



Driver Scanner

Taskkill & displaying printer problem

microsoft.public.windowsxp.customize




Recommended Fix - Fix Vista Errors and Optimize Performance


Driver Scanner 2009 - Free Scan Now
Reply
  #1 (permalink)  
Old 10-26-2009, 09:16 PM
joshakame
 
Posts: n/a
Taskkill & displaying printer problem

Hello everyone I am new to the world of command prompt, and especially
batch files. I have been given a project in class where part of my
assignment is to give the user options. One of the options is to kill a
task, the problem lies in that I cannot just kill every task, I have to
give them the option to kill whatever task they want. I am in a bit of
time pinch and would appreciate any help that people can give. I have
been searching for about 2 weeks in different medias on how to do this.


One last question and I hope I don't seem greedy...anyone know any easy
way without using an active directory option to display printers connect
to the computer?

Again any help would be wonderful and I appreciate it all.


--
joshakame
------------------------------------------------------------------------
joshakame's Profile: http://forums.techarena.in/members/149027.htm
View this thread: http://forums.techarena.in/customize-xp/1263522.htm

http://forums.techarena.in

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 10-26-2009, 10:11 PM
Tim Meddick
 
Posts: n/a
Re: Taskkill & displaying printer problem
What exactly is it you want to accomplish?

Taskkill.exe will terminate (kill) any program in memory you specify.

Just open a command prompt and type : taskkill /? for help.

Also, look at the command tasklist as well for a list of tasks to kill.

As with above, type : tasklist /? for help.

(Tip: use your mouse wheel to scroll upwards to see the entire help)

==

Cheers, Tim Meddick, Peckham, London. :-)




"joshakame" <joshakame.40oprd@DoNotSpam.com> wrote in message
news:joshakame.40oprd@DoNotSpam.com...
>
> Hello everyone I am new to the world of command prompt, and especially
> batch files. I have been given a project in class where part of my
> assignment is to give the user options. One of the options is to kill a
> task, the problem lies in that I cannot just kill every task, I have to
> give them the option to kill whatever task they want. I am in a bit of
> time pinch and would appreciate any help that people can give. I have
> been searching for about 2 weeks in different medias on how to do this.
>
>
> One last question and I hope I don't seem greedy...anyone know any easy
> way without using an active directory option to display printers connect
> to the computer?
>
> Again any help would be wonderful and I appreciate it all.
>
>
> --
> joshakame
> ------------------------------------------------------------------------
> joshakame's Profile: http://forums.techarena.in/members/149027.htm
> View this thread: http://forums.techarena.in/customize-xp/1263522.htm
>
> http://forums.techarena.in
>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-26-2009, 10:27 PM
joshakame
 
Posts: n/a
Re: Taskkill & displaying printer problem

I am trying to create a batch file that will give the user a choice of
the task files he wants to kill. So, for instance if he wants to kill
PID 456 (just an example) then all he has to type in is the PID, in
other words all he would have to type in is 456 and press enter. My
problem is that I can't figure out how to do that.


--
joshakame
------------------------------------------------------------------------
joshakame's Profile: http://forums.techarena.in/members/149027.htm
View this thread: http://forums.techarena.in/customize-xp/1263522.htm

http://forums.techarena.in

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 10-27-2009, 08:10 AM
Olórin
 
Posts: n/a
Re: Taskkill & displaying printer problem
joshakame wrote:
> I am trying to create a batch file that will give the user a choice of
> the task files he wants to kill. So, for instance if he wants to kill
> PID 456 (just an example) then all he has to type in is the PID, in
> other words all he would have to type in is 456 and press enter. My
> problem is that I can't figure out how to do that.


It would help to know how far you got in your two weeks of research - what
specific problems you're having with the work you've done so far, rather
than just doing it all for you.

That said, here's one I wrote a while ago (exactly as I wrote it! - feel
free to amend as needed) - between the two sets of "=====" just for clarity.

You need to specify (input) the name of the machine at run-time as well as
the PID, and find copies of the two files referred to and have them in the
right place (see the comment on line seven). It's a bit surprising that two
weeks' work didn't get you significantly far down this path or a similar
one, but heigh-ho. Do yourself a favour and read through this and be sure
you understand what's going on, how it works - make it "yours" before you
hand it in, or you ain't getting the education!

================================
@echo off
rem ***********************************
rem * Utility to kill off CPU-hogging *
rem * processes on any machine *
rem ***********************************
rem
rem Needs choice.com and pskill.exe in same directory or in Path
rem
set /p MACHINE=Enter the machine name:
echo.
set /p PID=Enter the PID number:
echo.
choice /c:yn Confirm request to kill PID %PID% on %MACHINE%:
echo.
if errorlevel 2 goto bale_out
if errorlevel 1 goto do_it
echo Shouldn't ever get to this line!

:do_it
pskill \\%MACHINE% %PID%
echo ZAP! Process nuked!
goto end

:bale_out
echo All right then, ya big wuss.
goto end

:end
echo.
echo Program terminating...
pause
================================


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 10-27-2009, 09:36 PM
Tim Meddick
 
Posts: n/a
Re: Taskkill & displaying printer problem
Here is a relatively simple script that is a "helper" for the programs tasklist and
taskkill.

After copying and pasting the text between the lines into a text file and [re]naming
that file TASKZ.BAT

You can then use it in two ways: 1). Interactively. Type TASKZ and the tasklist
(including a list of PIDs) will be displayed. After the task list is displayed, you
are prompted to enter a PID from the above list (use the mouse wheel to scroll up and
down the list to identify the Application / PID you want to terminate). Enter the
chosen PID and press ENTER and the application is terminated.

or 2). Add parameter. If you already know the PID of the app. you want to terminate,
just type TASKZ [pid]
(where [pid] stands for the numerical Process ID)

------------------- copy between lines -------------------

@echo off
SETLOCAL
if %1]==] goto TASKS
if %1]==/?] goto HELP
if %1]==-?] goto HELP
if %1]==?] goto HELP
goto TERMINATE

:HELP
echo.
echo Batch file to help terminate
echo an application by reviewing
echo all apps currently in memory
echo then entering it's PID to
echo terminate.
echo.
echo Or, if the PID is already known
echo enter TASKZ followed by [pid]
echo to terminate the application.
echo.
echo TASKZ [pid]
echo.
echo pid - Numerical App. ID
echo.
echo Type TASKZ to start interactively.
echo.
goto :EOF

:TASKS
echo.
echo A list of tasks and their PIDs
echo will now be shown - then type
echo a PID to terminate that app...
echo.
echo (Tip: Use mousewheel to scroll)
echo.
pause
tasklist
echo.
echo Now enter a PID from the above
echo list to terminate the associated
echo application.
echo.
echo (Use mousewheel to scroll up)
echo.
echo (Just press ENTER to cancel)
echo.
set /p PID=Enter PID=
echo.
if NOT DEFINED PID (goto CANCEL) else (goto TERMINATE)

:TERMINATE
echo.
echo Application ID=%PID%
echo.
echo Terminating...
echo.
taskkill /F /PID %PID%
if ERRORLEVEL 1 goto TK_ERROR
set PID=
goto :EOF

:TK_ERROR
echo.
echo The PID you typed was invalid
echo.
echo You must enter a valid PID number
echo from the list displayed.
echo.
goto :EOF

:CANCEL
echo.
echo Operation cancelled.
echo.

------------------- copy between lines -------------------

==

Cheers, Tim Meddick, Peckham, London. :-)




"joshakame" <joshakame.40ovbc@DoNotSpam.com> wrote in message
news:joshakame.40ovbc@DoNotSpam.com...
>
> I am trying to create a batch file that will give the user a choice of
> the task files he wants to kill. So, for instance if he wants to kill
> PID 456 (just an example) then all he has to type in is the PID, in
> other words all he would have to type in is 456 and press enter. My
> problem is that I can't figure out how to do that.
>
>
> --
> joshakame
> ------------------------------------------------------------------------
> joshakame's Profile: http://forums.techarena.in/members/149027.htm
> View this thread: http://forums.techarena.in/customize-xp/1263522.htm
>
> http://forums.techarena.in
>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 02:34 PM.




Recommended Download



Design by Vjacheslav Trushkin for phpBBStyles.com.
Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74