Solved

Taskkill

Posted on 2011-03-04
6
937 Views
Last Modified: 2012-05-11
I need a coomand line script to see if jqs.exe is running and if it is do taskkill /f /im jqs.exe
0
Comment
Question by:underground712
  • 3
  • 2
6 Comments
 
LVL 51

Expert Comment

by:Bill Prew
ID: 35037411
Why bother checking if it's running just to kill it.  Do the killtask all the time and if it isn't running it will just fail to kill anything.  If you want to suppress the error message from killtask then you can do:

taskkill /f /im foo.bar >nul 2>%1

~bp
0
 
LVL 30

Accepted Solution

by:
Zoppo earned 125 total points
ID: 35037462
Hi underground712,

I agree with billprew, there's no need to check if the process is running.

Anyway, if you really want to check it before you can use this in a batch file:

@echo off
tasklist | findstr "notepad.exe" > nul
if %ERRORLEVEL%==0 taskkill /f /im notepad.exe

Open in new window


ZOPPO
0
 
LVL 30

Expert Comment

by:Zoppo
ID: 35037469
Sorry, of course the notepad.exe is wrong in lines 2 and 3, I used this for testing - replace it with jqs.exe
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 51

Expert Comment

by:Bill Prew
ID: 35037502
Ditto for replacing "foo.bar" with "jqs.exe"...

~bp
0
 
LVL 1

Author Comment

by:underground712
ID: 35037523
it has to be checked, cause just the taskkill is running from zcm10, and script engine reports to the user when installing the application
0
 
LVL 51

Expert Comment

by:Bill Prew
ID: 35037648
And we can simplify a little more to get it down to a single line like this:

tasklist /FI "IMAGENAME eq jqs.exe" 2>NUL | find /I "jqs.exe" >NUL && taskkill /F /IN jqs.exe

Open in new window

~bp
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now