Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Process Persistence-Need Help

27 Sep 2014   #1
TooEasy123

 
 
Process Persistence-Need Help

Hello,

I am trying to design a simple antivirus, and I am at the point where i am creating a batch file that will make sure the Antivirus scanner is running. Here's my plan:
1. Batch file in startup folder with a loop function
2. Said batch file does a tasklist command and searches for the name of the file on the running processes
3. If it finds the process running it does nothing
4. If it does not see the process running, it simply starts it again
It is very simple design but I am running into trouble when i am writing the code. My question is: How do I write this idea into a command? The idea being how the if statement factors into the tasklist command. So I need the tasklist command to be filtered to see if the process is running based on the name, and then I need to set the output of the tasklist command as a variable so that I can write the if statement: if %process%==Client.exe (goto yes)


My System SpecsSystem Spec
.
27 Sep 2014   #2
Tookeri

Windows 7 Pro 32
 
 

Hi and welcome to SevenForums!

Here's one example
Code:
set PROCESS=
for /f %%A in ('tasklist ^| find "Client.exe"') do set PROCESS=%%A
IF "%PROCESS%" == "" GOTO NOTRUNNING
ECHO Process running!
GOTO DONE

:NOTRUNNING
ECHO Process NOT running!

:DONE
The output from tasklist is filtered with the find command to search for your process. If the process wasn't found the PROCESS variable will be empty. The value for PROCESS variable is irrelevant and will contain more information than just the process name. But if the variable isn't empty then it means the process was found in the tasklist.
That should work
My System SpecsSystem Spec
Reply

 Process Persistence-Need Help




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
"Error opening process" message in Process Explorer
Hi Everyone I recently did a System Restore on a Windows 7 Pro 64 bit system to correct a strange problem I was having with IE. It seems to have solved the problem, but now Process Explorer is displaying the messages in the screen shot below, and I'm not sure why. The computer is functioning...
Software
open explorer, starts new process, close it, process remains active
Hi, I've got a quicklaunch shortcut to: %windir%\explorer.exe shell:::{323CA680-C24D-4099-B94D-446DD2D7249E} That takes me straight to my explorer favourites. What I notice is that when I launch that, I get a new explorer.exe thread appear in the task manager. When I close it though, that...
General Discussion
Persistence module stopped working
Just happened this morning, I don't why, I didn't do anything the day before that stopped working, already did a system restore to 4 days before this problem started, but still happening. Also, when it happened, I got some BSODs, unfortunately, system restore wiped the other 4 .dmp files. Code for...
General Discussion
Windows 7 + Process Explorer + Patch: [Opening error process]
Hi fooks, I hope you all can read this, i'm from Belgium so my Englsich is not as good as it might be. I have bought last year a little notebook with Windows 7 Home Premium on it. On this machine i am the Administrator, and there are no other people on that, or guestaccounts made. On...
Installation & Setup
Credential Mgr- What determines persistence?
How is or what determines whether a credentials persistence is "Enterprise" or "Logon Session"? Is there a way to change persistence? I have several users who continually have to enter their password in Outlook(2007 or 2010) when first started. The only difference(that I can see) between the...
General Discussion
connection by the system process and killed process
I have a few apps running, incl. Firefox, Outlook. I took down their PID and then exit those programs. I run the following command: netstat -a -o -b -p tcp It will list many connections like below TCP 192.168.83.2:57471 xx.xx.xx.xx:http ESTABLISHED 4184 TCP ...
Network & Sharing


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 06:10.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App