Jump to content

Batch file to automate updates


Recommended Posts

Hello TheDoc and welcome to Malwarebytes!

If you already have a basic understanding of batch files, all you would really need to look into is the schtasks command. Just type schtasks /? in a CMD Prompt window to view the help on it. If you have any questions, just post back. I can post some links if you need to start from scratch as well.

Regards,

swagger

Link to post
Share on other sites

  • 5 months later...

I would like to update this topic with one additional question re the potential for using a batch file (I have the fee Malwarebytes). By the way the schtasks /? did NOT work on this XP PC. No idea of course why. What I would like to do is create a batch file that both first did the Update, and then automatically, after the download, run the scan. So where do I look for the details of what needs to go into the batch file, to include the question of whether this is possible in a batch file (so I go back to MS-DOS 3.3; I remember VERY little about all of that). Thank you.

Link to post
Share on other sites

@ JackInCT

These items are available in the full version of Malwarebytes. The full version will not only help you with scheduled updates, but also with scheduled scans. It will also protect you from malicious web sites with the IP Protection features. Well worth the one time fee for a life time license.

How To Use The New Scheduler

Link to post
Share on other sites

@ JackInCT

These items are available in the full version of Malwarebytes. The full version will not only help you with scheduled updates, but also with scheduled scans. It will also protect you from malicious web sites with the IP Protection features. Well worth the one time fee for a life time license.

How To Use The New Scheduler

Perhaps I didn't make this clear-I have the pay for Malwarebytes, and I was aware of the Scheduler, but that requires a fixed time, and my routine won't allow that, i. e., I need the flexibility of a batch file that I can launch at will. And since I have a good idea of how long the update and the scan lasts, when I leave my PC, and I know that I will be away longer than the time it takes to do the Update and scan, I would want be able to simply launch all that in one fell swoop and be on my merry way in a blink of the eye as I run out somewhere. I know it's not going to save me tons of time since it doesn't take that long to do that manually, but its obviously a convenience thing assuming of course that the batch file doesn't require advance DOS skills that I have completely forgotten about.

Link to post
Share on other sites

Greetings JackInCT :)

With the paid version, you're best bet would likely be to schedule udpates to happen in Realtime, that way the database is always up to date, then create a batch file that uses the following parameters that you can run on-demand manually:

[path to Malwarebytes' Anti-Malware folder]\mbam.exe /scan -quick -log -terminate

You can also add -remove to that if you want it to remove any detected threats automatically. I recommend the -quick option since Malwarebytes' Anti-Malware's Quick Scan is designed to check all known locations that active infections like to hide.

Link to post
Share on other sites

Well Exile360, I am going to begin by giving you my heartfelt and sincere thank you for taking the time to answer my post. The rest of this reply has absolutely NOTHING AT ALL to do with your efforts, but the lack of gray cells between my ears.

For 2 long grueling, arduous hours, I relieved those days long ago when MS-DOS and I became mortal enemies as I struggled with what I think were called

Link to post
Share on other sites

  • Root Admin

Well you can run the following if you really like and want to do it via batch but as said using the scheduler would be best method as it can be set to run fully silent and while you're asleep.

This method also requires that the program be registered to be used in a non interactive batch.

@ECHO OFF
SET | FIND /I "ProgramFiles(x86)" >NUL
IF %ERRORLEVEL% == 1 (
CD "C:\Program Files\Malwarebytes' Anti-Malware"
START /WAIT MBAM.EXE /UPDATE -SILENT
START MBAM.EXE /SCAN -FULL -LOG -TERMINATE -REMOVE
) ELSE (
CD "C:\Program Files (x86)\Malwarebytes' Anti-Malware"
START /WAIT MBAM.EXE /UPDATE -SILENT
START MBAM.EXE /SCAN -FULL -LOG -TERMINATE -REMOVE
)
EXIT

Link to post
Share on other sites

OK-In all seriousness, for a change, I really do own a book somewhere around this house from the DOS era, that is somewhere in the 300-400 pages length [not a typo], and I guess I should try to find it to comprehend the latest suggestion for a batch file. Many books from that era had the word, "Bible" in their title as mine does [and it is very well written], possibly based on an unconscious fear that it would take a belief system type 'act of faith' for a non-tech person to actually learn, and USE what they've learned [the "Dummies" type books were far off, time wise].

And I haven't mentioned this before, but my short term goal is indeed to do this PRIOR to bedtime IF I can ALSO write a batch file to do the following: run Malwarebytes and immediately after my new backup software to a dedicated HD for just the backup file. So the question I have is this; is it technically possible to write a batch file to launch two programs in succession in XP, and have the second one wait its turn until the first one was finished? Thanks to all of you for your forbearance.

Link to post
Share on other sites

I'm making this post re a possible quirk in my bat file, or more likely that I have zero grasp of what the "strings" after the mbam.exe can, or cannot do.

I just ran a completely manual full scan (there were no updates available today).

I then IMMEDIATELY ran that bat file, and I know from periodic viewing of my monitor that it took the same amount of time as my manual one. The manual one created the typical log; my bat file created no log entry at all. So what should I make of that since there is a "-log" 'statement' following mbam.exe.

Link to post
Share on other sites

The -log entry is supposed to make sure that the scan creates a log regardless of other settings, however there is currently a known issue with silents scans where no log is created. This will be fixed in the next version, 1.47, of Malwarebytes' Anti-Malware but the release date of the next version is yet to be determined.

Link to post
Share on other sites

Thank you Exile360 for responding to my query; that obviously saves a DOS novice (at this point) like myself from anymore spinning my wheels. And I will also try Forum Diety's code very soon, and I will post a comment how that went. As I noted in a previous post, my goal with all of this is to auto-launch Malawarebytes first, and then my backup software immediately. I should have also noted that, since that can be done at night where how long it takes is of no concern, I'm also giving some thought to doing my antivirus's own thorough scan too, with the express purpose of making all backups as virus free, etc., as I can teach myself how to do re the details so that each and every one, if ever restored, will take me back to a 'pristine' state rather than an infected state. I'm NOT lacking in ambition, but the tools to accomplish all that. Thanks again to all of you; you've been very patient with me, and I hope, as I assume all of you moderator types also do, that other forum members have, perhaps, had a door open for that re my own personal goals that anyone can take advantage of re not only the rationale for my posts, but what I hope to accomplish so that they can do the same thing; those are things that none of us will likely ever know.

Link to post
Share on other sites

  • 2 weeks later...
Well you can run the following if you really like and want to do it via batch but as said using the scheduler would be best method as it can be set to run fully silent and while you're asleep.

This method also requires that the program be registered to be used in a non interactive batch.

@ECHO OFF
SET | FIND /I "ProgramFiles(x86)" >NUL
IF %ERRORLEVEL% == 1 (
CD "C:\Program Files\Malwarebytes' Anti-Malware"
START /WAIT MBAM.EXE /UPDATE -SILENT
START MBAM.EXE /SCAN -FULL -LOG -TERMINATE -REMOVE
) ELSE (
CD "C:\Program Files (x86)\Malwarebytes' Anti-Malware"
START /WAIT MBAM.EXE /UPDATE -SILENT
START MBAM.EXE /SCAN -FULL -LOG -TERMINATE -REMOVE
)
EXIT

This batch file ALSO works quite well via a test that I ran using it (took a while to get round to it). Thank you for all the help with this-well done. And YES, Long Live MS-DOS.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
Back to top
×
×
  • Create New...

Important Information

This site uses cookies - We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.