Jump to content

Batch file that excutes when a program is installed. How?


linux_n0ob

Recommended Posts

Is there a way to have a batch file executed when a file of a designated name is executed. Can a batch file watch for processes and when a specific one shows up it executes itself?? For example if someone downloads the Firefox installer and executes it without admin approval can i write a batch file that will activate when the file is executed? The batch file needs to work without the ability to know the location of the Firefox installer, thats why i asked if you can watch for processes. I hope you can understand what i am trying to ask. Thanks for the help

Link to comment
Share on other sites

It can be done with soemthing that monitors the system, similar to UAC on Vista, or just a good firewall, like ZoneAlarm that catches any files trying to run and would require admin or password approval before they can execute. ZoneAlarm is good at this because it not only blocks files, you can make it take ones that are already installed and kill them so they can't start, which is nice if you want to lock down a machine using this feature. ZA can be password protected,so  they can't get around it or disable it without entering the password.

Writing an app with this kind of power over the OS would be very usefull but would probably interfere with any current antivirus or firewall software installed. I do not think a bat file would work in this case as they only run on demand or at scheduled times, but a program or service that is always running could start the bat script. Why you would need to do it that way, I don;t know. I would just have the executable do whatever you want the bat script to acomplish.

This type of program would have to look for many api calls in the system. An easy way is to write something similar to a key logger that can catch any program started with the words you want to search for in the caption of the programs title bar. For example, when you launch Solitaire, you always get the word Solitaire in the caption bar. This tells you that the solitaire program is running. I had(a long long time ago) written a key logger that would search for AOL in the program title bar so that I could know when my sister was getting on aol and I could get her password. It worked like a charm. The program only started logging when it saw the words AOL in the title bar, so it kknew that was when AOL started. Using something similar, you could have it check for specific hooks like the caption method and then launch your bat script if it saw the Firefox installer starting, etc. It doesn't have to be a keylogger, but it can track any number of things on the pc, from the name of programs starting, to the caption in the title bar, to keys pressed and even key combos, etc. Sadly, I do not have the source code for this little app any more, but most of the code I used was modified from things I found on PlanetSourceCode's VB section. Just knowing how to combine and modify the correct pieces of code and modules will make an app for what you need. BTW, it was written in VB6 and worked on windows95, and 98. I am not sure if the same window handler method works the same in XP, but I am sure there is probably some easy code on PSC that would do just what you are asking.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...