Thursday, December 30, 2010

Batch File for IP Change

There is a plenty of users that want to change the IP address of a computer with help of batch files. There is a simple way to perform it, all you need is standard netsh command and some imagination to 'invent' a new IP address.
The following line of code will help you to set the IP address and the subnet mask:
netsh int ip set address name = "LAN" source = static addr = mask =
Of course, you have to use real IP address instead of samples given above ( and
Also we advice you to learn netsh command because it's really useful for different networking operations.

Friday, December 24, 2010

Batch File to Delete Itself

Sometimes users of Dr.Batcher ask us how to create a batch script that is able to delete itself. It is not hard, and the example of self-destructive script is placed in Dr.Batcher's installation package.
The trick is to call command-line processor (previously known as with instruction to delete this batch file. While the processor is working, the source batch file will be already finished. Thus the processor will be able to delete it.
This is 'theory'. Practically you are to write the following batch code. Caution: do not run this file in folders with any valueable content, it may cause its loss or destruction.
REM Self-Deleting Batch Script
REM This script will delete all files in current folder, including itself

REM Don't forget to make backup copy of all files in current forder before its execution
ECHO This script will delete everything in current folder

ECHO Terminate it to cancel the action


CD ..
START CMD /C RMDIR /S /Q "%~dp0"
The logic of whole the script is situated in the last construction. It starts the command-line processor and tells it to remove the whole directory where this batch script is placed. Of course, you can write additional batch file with this command instead. Also you can use 'DEL' instead of 'RMDIR' if you want to delete only batch file itself.

Saturday, December 11, 2010

Interesting Way To Delete Empty Folders through Batch Files

Deleting different garbage with help of batch files is quite a common task. Quite interesting way of solving this problem I have found on The author of this article plays with parameters of DIR command to retrieve the names of all empty folders on a certain logical drive and then saves them to text file. After that this file should be renamed with extension BAT or CMD, and each line should start with "rd " before the directory's name. It's really interesting and quite unusual, but still fast and effective way to clear empty folders through batch files.
You should just remember that some applications require empty folders to be run, and removing these folders can make these applications useless till their re-installation.

Sunday, November 28, 2010

We're Going to Launch New Site for Dr.Batcher

Mental Works Computing Software is proud of announcing Dr.Batcher's new site under construction. This site will not be just the re-designed old one. We are going to create special new section with tips and articles on batch files. Of course, the design will also be updated. The site will look much better and it'll be easier to navigate on it. Also we plan to create video-tutorials on creating batch files for different purposes with help of Dr.Batcher. Hope you'll be able to enjoy it all in a month or two.

Thursday, November 25, 2010

What Tasks Can One Automate with Help of Batch Files?

We are sometimes asked: "What kind of tasks can I automate through batch files?" Our usual answer is "any kind". Of course, it depends on your needs. Here are some common tasks for IT specialists that can be automated with help of batch files.
Administrator: creating and restoring backups, changing network settings, cleaning junk files, starting and stopping services...
Programmer: making builds, starting applications under certain runtime environment, running different command line-tools with specified set of options...
Beta-tester: running applications with given parameters, running applications under different environments...
Here are just a small amount of examples. For what do you use batch files? Share your experience in comments.

Wednesday, November 10, 2010

How to Start or Stop a Windows Service with Help of Batch Files

Some users ask us how can they start Windows service with help of a batch script. That's why we decided to write a short post on this topic in our team's blog.
First of all it should be mentioned that starting or stopping some Windows services can make your system work strangely. Thus you should work with services really carefully, especially with standard services installed while the installation of the operating system.
Actually, you should know only one command to run or end Windows services. This command is called NET. To run a service you should add to your batch file the following line:
NET START "Service Name"
And to stop a service you have to use this construction:
NET STOP "Service Name"
Of course, you have to use the real name of the service you want to start or stop instead of Service Name.
It's really easy to work with services, as you see. If you have any questions about batch files, feel free to ask us via

Monday, October 25, 2010

Dr.Batcher 2.1 Is Released

Today we're glad to introduce new version of Dr.Batcher. Though there is a lot of different small improvements in it, the main difference between this and previous versions is support for compiling batch files to EXEs. We've tried to make the process of EXE creation as handy as possible, so today you can find a new wizard in Dr.Batcher (choose "Tools" -> "Compile EXE File"). The wizard look like this:

You can find detailed information about the new version of Dr.Batcher here. Hope you'll enjoy it. You are still always welcome to send your suggestions and reports at

Wednesday, October 6, 2010

Creating And Upacking ZIP Archives Using Batch Scripts

Sometimes it's necessary to create archives and extract files from them with help of batch files. For instance, it's useful when you writing scripts for automated backups. There is a number of different console archivers available on market, but still the most famous one is PKZIP (together with unpacker PKUNZIP). This archiver is especially useful for those who still use DOS for some reason.
The following command will help you to compress all files in the current forder:
PKZIP -a -ex -r -P -whs %1 *.*
If you put this line to a text file and save it as 'zip.bat', then you should just call 'zip.bat c:\' to compress all files from the current folder to c:\
To extract files from the created archive to the current folder, you have to use the following command:
PKUNZIP -d %1 -o .\
The only parameter passing to this short batch file is the name of ZIP to be extracted.

Saturday, September 18, 2010

Checking for Existence of a File in Batch Scripts

Sometimes it is necessary to check whether a file exists in a certain folder. Batch scripting provides a programmer with a really nice construction called 'If Exist'. It's pretty useful when you want to check for existence of a given file, for example, 'autoexec.bat'. To check for it, you should write the following code:
If Exist autoexec.bat Echo Autoexec.bat exists!
But if you try to check for existence of any files in the way described above, you'll be surprised. Written '*.*', you'll be notified about existing files anyway, even when there are no files in the given folder. So instead of using '*.*' in 'if exist', it's better to look at the following code:
@Echo Off
For %%a In (1\*.*) Do Call :File_Ex %%a
If Defined FileExist Echo Exist
Goto :EOF
Set FileExist=Yes
Goto :EOF
This code will give you proper answer about files in the specified folder, and you can include it into your own batch scripts. Hope it'll be useful for you.

Thursday, September 2, 2010

Dr.Batcher 2.0.3 Is Out

We're glad to introduce Dr.Batcher 2.0.3 - a new version of the award-winning batch files editor. In this version you will find:
  • Search features in 'Add command' window (see screenshot)
  • Support execution of a script without saving it
  • Support for sending bug reports from menu
  • 9 new examples
  • Small bugfixes.
You can find new version of Dr.Batcher here. Hope you'll enjoy it.

Sunday, August 22, 2010

Dr.Batcher's Roadmap

Some people ask us 'When are you going to release in Dr.Batcher?'. Of course, Dr.Batcher's development goes not very fast, but still we decided to continue it, and you'll see new features in our software soon.
Version 2.1: support for compiling batch files to EXEs;
Version 2.2: tab-based multi-document (MDI) interface;
Version 3.0: debugger for batch scripts;
Version 3.1: mixed (both Simple and Professional on the same screen) mode;
Version 3.2: handier professional mode editor;
Version 3.3: handier simple/mixed mode editor.
If you have any suggestions, feel free to contact us via e-mail ( or leave your comments here!

Friday, August 13, 2010

Are Batch Files Still Alive?

There are lots of users and even system administrators who suppose batch files scripting to be dead. Why do they think so? The most common arguments are:
  • there are lots of modern scripting techniques (PowerShell, WSH, etc.) that are simple in use;
  • you can't make with help of batch files anything you want, or it's really difficult;
  • you have to use GOTO - possibly, it's the worst reason not to use batch files:)
Why do people still discuss about batch files on forums and blogs? Why don't they take all needful code and translate it into PowerShell? Possibly, batch files are not so bad. They have clear and simple syntax, you can run them under any version of Windows and they are usual for those who started to deal with computers in DOS era. That's why I can say: batch files are still alive. Don't agree? Wait for your comments!

Monday, August 2, 2010

Dr.Batcher 2.0.2 is released

After half a year of break Dr.Batcher 2.0.2 is released. In this version you will find:
  • group "echo" and "@" modifiers;
  • pop-up menu in Simple mode;
  • new options;
  • support for adding unknown commands in Simple mode;
  • 'Do not print this command in console during the execution' option in command editor;
  • new 'Create Batch File' dialog;
  • fixed parsing TAB characters;
  • small bugfixes in UI.
Here you can see how new 'Create Batch File' dialog looks:
You can find new version of Dr.Batcher here. Hope you'll enjoy it.

Monday, January 4, 2010

Installing Fonts Using Batch Files

Installing fonts is not really common task performing every day by thousands of people. Still one day you can understand that you are to install fonts with help of batch scripting. Fortunately it's really won't take a lot of time to create a batch file to install several fonts. You should just copy them into Fonts directory and add some keys to the Registry. Here is the batch script you are to execute:
copy font.ttf %systemroot%\fonts
regedit /s font.reg
The only trouble is that you have to create REG-file first. It will take a few moments to add the following lines to font.reg:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
"Font Name"="font.ttf"

Put down the real name of your font instead of "Font name" (leave commas). Also don't forget to reboot after the font's installation. That's all!