|
Answer» So I wrote a batch file that was suppose to close out a program and STOP it from opening using taskkill, but it doesn't seem to be doing anything at all. When I went into cmd to see if it was a typing error, it closed. Any Ideas?
Code: [Select]@echo off :loop taskkill /im extraSecurityBackup.exe /f goto loop
EDIT: OS = win7What is securitybackup.exe and why don't you prevent it from running in the normal way? It sounds like maybe you don't have admin privileges. I am trying to write a program to keep my brother off my computer. (he tends to guess all my passwords too quickly). Securitybackup.exe checks to see if the PASSWORD prompt is running, and uses shutdown -s -f -t 1 I wrote that program for testing, and later planned to implement it into the password prompt.
Code: [Select]@echo off :loop set a=0 tasklist /FI "IMAGENAME eq extraSecurity.exe" 2>NUL | find /I /N "extraSecurity.exe">NUL if "%ERRORLEVEL%"=="0" set /a a+=1 tasklist /FI "IMAGENAME eq extraSecurityBackup2.exe" 2>NUL | find /I /N "extraSecurityBackup2.exe">NUL if "%ERRORLEVEL%"=="0" set /a a+=1 if %a% EQU 2 goto loop shutdown -s -f -t 1 (extraSecurityBackup2.exe does the same thing, but w/ securitybackup.exe instead, so you cant kill one w/o shutting down the computer)
How would I go about allowing the file to run with admin privileges? (w/o GOING RightClick -> Run as Administrator)
Off topic: is there a way to get TASKLIST /FO LIST to not display memory usage?Why don't you make up a password that he can't guess? A strong password is a good idea anyway. If it had 16 characters, INCLUDING upper and lower case, numbers and symbols he would have a hard time. Even better, why don't you find a way of stopping him using it?
if you want tasklist /fo list but without the memory usage, pipe it through FIND /V like this
tasklist /fo list | find /v "Mem Usage:"
Thank you so much! Just had to add on a couple more pipes and it worked beautifully.
And it was more of an excuse to put of homework than actually protect my computer He'd stop if I asked nicely.Quote from: Lemonilla on June 05, 2012, 02:53:52 PM And it was more of an excuse to put of homework
|