1.

Solve : Is there a way to block a program from opening with batch??

Answer»

Is there a code I can type to block a program from opening?
lets say I open my batch file and then TRY to open internet explorer and I get a message that says "access denied". Is this possible? if so what's the code?


Thanks,
S_R_SNope not really.
You can run the batch file on a separate user account and then deny that user access to what ever file you don't want that batch file to access. IT CAN BE DONE ... I did it to block IM programs on our corporate computers where users unfortunately need to run as admins for software like Pagemaker 6.52 to run properly.

What I did was search for specific EXE names that are UNIQUE to the program you want to block and move the EXE to another location and replace it with a compiled Batch with the same file name. So replace IM.EXE with IM.EXE in same path, so that the a compiled to EXE batch runs stating that this software is not allowed on this computer SORRY! and pause command to exit batch. This is made up of 2 batches, one that on startup searches C:\program files and copies the found exe's to another destination and replace the exe with the 2nd compiled batch as an exe using a program like BAT2EXE.

This works as long as you dont have a user smart enough to delete the batch from startup folder and only as long as they dont reinstall the program and dont reboot in which it wold run until the next reboot when its GRABBED again.

In addition to this, I added more to my batch to block out P2P, IM, IRC, and a bunch of other unapproved software from operating and it works well. User only see's a shell window for about 10 seconds on start up and then the system is clean.

If they click to LAUNCH the installed unapproved software, they get a blat that it is Unallowed from the second batch that is compiled as the same name as the original EXE file. By just deleting the EXE it will just cause a flashlight search for the exe or have a negative affect. By having a custom exe of the same name, the Windows OS is happy, and your EXE runs instead of the programs EXE with is unallowed.

Here is my SSC ( System Software Control ) script code:


REM Mirc Chat 00
REM Softros Messenger 00
REM Google Talk Beta 00
REM ICQ Lite 5.1 00
REM MS Messenger 2004 01
REM AIM6 AOL IM 01

REM Point to Root of C DRIVE before executing Replace Functions
c:
cd\.

REM Block AIM6 Install and Execution
replace c:\vendor\ssc\aim6.exe "c:\program files" /S/R

REM Block MS Messenger 2004 Install and Execution
replace c:\vendor\ssc\msmsgs.exe "c:\program files" /S/R

REM Block ICQ Lite 5.1 Install and Execution
replace c:\vendor\ssc\icqlite.exe "c:\program files" /S/R

REM Block MSN Messenger Install and Execution
replace c:\vendor\ssc\msnmsgr.exe "c:\program files" /S/R

REM Block AOL Instant Messenger Install and Execution
replace c:\vendor\ssc\aim.exe "c:\program files" /S/R

REM Block ICQ Install and Execution
replace c:\vendor\ssc\icq.exe "c:\program files" /S/R

REM Block Mirc Chat Install and Execution
replace c:\vendor\ssc\mirc.exe "c:\program files" /S/R

REM Block Yahoo Messenger Install and Execution
replace c:\vendor\ssc\ymessenger.exe "c:\program files" /S/R

REM Block Softros Messenger Install and Execution
replace c:\vendor\ssc\messenger.exe "c:\program files" /S/R

REM Block Google Talk Beta Install and Execution
replace c:\vendor\ssc\googletalk.exe "c:\program files" /S/R


echo on
cls
color 07

-----------------------------------------------------------
*** THIS IS NOT CODE: Below is the AIM6.EXE compiled to EXE Batch. This was just renamed for each program blocked and text edited to reflect each program block blat. I also did away with copying the EXE's elsewhere on this REV. 2 batch, so you will see that missing, but easy to add before the replace script if you want that feature.
-----------------------------------------------------------

cls
color 0c
echo off
cls
@echo.
@echo.
@echo. *********************************************************
@echo. SORRY -- AOL AIM Chat is not authorized to operate
@echo. within the CFS Network as per security reasons...
@echo.
@echo. Please contact IT with any questions...
@echo.
@echo. *********************************************************
@echo.
@echo. Please press any key to exit this message
@echo.
@echo.
@echo.
@echo.
pause
echo on
color 07

-----------------------------------------------------------
*** THIS IS NOT CODE: Below is the AIM6.EXE output to user when they try to start AIM to chat!!!

-----------------------------------------------------------





*********************************************************
SORRY -- AOL AIM Chat is not authorized to operate
within the CFS Network as per security reasons...

Please contact IT with any questions...

*********************************************************

Please press any key to exit this message




Press any key to continue . . .


---------------------------------------------------------------------------
The heart of the script is this simple function.


replace c:\vendor\ssc\msmsgs.exe "c:\program files" /S/R

Where C:\vendor\ssc\msmsgs.exe is replaced with the path to your blat batch where ever you want it to reside on the local system. And as a result of the actual EXE being overwritten with the compiled batch to EXE with same name, Windows doesnt know better and it stops the program from running!!!



Hopefully this will work for you application as its worked well for mine and I have been adding more to it as time goes bye and more programs are black flagged for blocking.



Discussion

No Comment Found