Monday, February 18, 2013

Batch File to Clean Temp Folder

It is necassary sometimes to clean temporary files because they can waste large amount of space on your system drive. You can download one of system cleaners or even pay to its developer. But you should be aware of different kinds of malware in these cleaners. It is much better to use a simple batch script like this:
REM ********************************************
REM * Cleaning example script *
REM ********************************************
REM * This script shows how to clean the folder*
REM * from temporary files *
REM ********************************************
REM This string specifies that no details will be shown
@ECHO off
REM Change current forder to the temp folder
CD TEMP
REM Delete all files with extension starting with ~
DEL *.~*
REM Delete all files with extension TMP
DEL *.tmp
REM Add your extensions!
ECHO Press Enter!
PAUSE
EXIT
Hope this script is quite simple and you can understand what it does from the comments, but if you have any questions you are always welcome. Leave comments under this post or send a letter to support@m-w-c-s.com.
Want to learn how to create batch file? Subscribe our RSS feed!

Tuesday, February 12, 2013

How to Make Changes in Windows Registry Using Batch Files?

 It seems that the simplest way here to make changes in Windows registry is to use REG files. These are special text files that function in Windows for making necessary Windows registry changes without searching long for the key in the tree shown by RegEdit. As I see it, the matter goes about making batch changes in the case you can manage without BAT files at all: you may write several registry keys into one REG file and the keys will be changed while REG file is launched. But if you need to generate registry keys dynamically, BAT file can perform REG file generating and launching. The only question is how to create batch file.
REG-files have a simple format. In fact it is a text file written as follows:
[HKEY_LOCAL_MACHINE\Sub1\Sub2]
"Par1"=dword:0
"Par2"=”string”
"Par3"=hex:cc,1b,00,00,00,40,3d,68

Here, it’s obvious, instead of lines in brackets you should put the real path to the branch in registry which parameters you are intend to change (do not omit brackets). The names of these parameters should be quoted and the same for their values, in case of line parameters. For DWORD and HEX parameters, as in example, write its type and put colon after equals in the line. Do not separate the values somehow – changes in parameters, starting with a new line in brackets, will be made to a new address. At the beginning of the file put the line “Windows Registry Editor Version 5.00” (without quotation marks) – this line is necessary for the Registry Editor to determine whether this file includes the keys for making registry changes – it is very important to include them into REG files. Also, do not forget to name the extension of the output file as .REG.
To compose the file use “>>” - command. That is a standard way to convert BAT file data into a text file. For making changes in the registry you use regedit utility in which REG file’s name should be used as a parameter, for example, “regedit crack.reg” (without quotation marks).

Friday, February 1, 2013

Dr.Batcher 2.2.1 Is Available!

Though Dr.Batcher has quite a long development history, new versions of this software don't appear very often. We are glad to announce the new version of our award-winning tool to create batch file.
What will you find in this new version? Here is the list of new features:
  • added context menu for tabs
  • indication of executing scripts in tabs captions
  • CABARC in the list of supported commands
  • own console output for each opened file
  • undo close tab
  • updated help file & printable manual.
 As usual, you can download Dr.Batcher from its official Web site.

Thursday, January 10, 2013

What is errorlevel?



 Sooner or later every batch files creator faces the problem of checking the result of one command execution before executing the other one. For that we have built-in variable “errorlevel” that changes its value after each command execution. Its value can vary for different commands used in batch files. Usually successful execution of the command is displayed as zero value of variable, but not always other value implies any errors. So if you create batch file, you should remember about this meaning of errorlevel.
This variable is used as follows:
if errorlevel 0 echo Errorlevel is 0 or greater
Instead of “echo Errorlevel is 0 or greater” you can put any necessary command. After “if” you can add “not” (no quotation marks for this time again) – then the value becomes diametrically opposed. It should be mentioned that “errorlevel N”-construction does not mean precise equality of variable “errorlevel” to value N. It means that the command will be executed only in case “errorlevel” value is or is greater than N. Thus it is more convenient to check errors with the help of “if errorlevel” –construction than to execute the command successfully. But if you write “if not errorlevel 1”, that means in case “errorlevel” is nonnegative, we obtain the result of “errorlevel” equal to zero. Unfortunately nonnegative values of this variable are not guaranteed. For more details you can read about “if errorlevel” –construction in Windows help manual.

Saturday, January 5, 2013

Why Is There No Percentage Mark in the Line Seen on the Screen?



In batch files percentage mark is used to indicate variables, or variable environments, or internal variables of the BAT-file. So, if you’d like to see percentage mark on the screen, you just need to use it twice: for example, “echo This day performed 0.25%% of the whole project”. By the way, is not the only symbol that has a special meaning in BAT files. Such symbols also include “>”, “<”, etc. They can be displayed on the screen with the help of combinations “^<”, “^>” (i.e. you put a tick before the symbol).

Wednesday, December 19, 2012

How to Convert Batch File to EXE

Despite the fact batch files are quite useful for different purposes, it is better sometimes to convert them into executable ones. Today we will learn how to convert batch files to EXE. The easiest and fastest way to convert it is utility Dr.Batcher. It offers a special wizard that lets you convert batch file to EXE in several clicks.
1. Download Dr.Batcher and install it on your computer
2. Start Dr.Batcher and open the batch file you want to convert.
3. Choose ‘Tools’ -> ‘Compile EXE File…’. Follow the wizard instructions.
4. Enter the output file name, choose application type and security options. Check ‘Console’ to create application that will show console output during the batch file execution, or choose ‘Invisible’ to hide the console output. Check ‘Protect batch file and additional files to pervert reverse engineering’ to encrypt the output file. Click ‘Next’.
5. Choose the additional files your script needs while execution. It might be some external applications (for example, zip for backup scripts), other scripts or any other file. Click ‘Next’.
6. Click ‘Next’ to create the executable file.
7. Click ‘Run the created file’ to test the converted EXE or ‘Finish’ to exit the wizard.

Friday, September 7, 2012

New Version of Dr.Batcher Offers Backup Script Wizard

The new version of Dr.Batcher, the award-winning tool for creating and editing batch files, comes with support for creating full-featured backup and restore scripts in a few clicks.
Version 2.2 of Dr.Batcher, a powerful tool for batch files creation and editing designed both for advanced users and newbies, offers brand new Backup Script Wizard. Now one can create compressed (ZIP, CAB archive formats supported) or uncompressed backups with the help of batch scripts, and restore them. All compressed backups can be protected with passwords, also the level of compression is changeable.
It should be noticed that the new version of Dr.Batcher comes with multi-document tabbed user interface. Now one can easily move from one batch file to another during programming them and make changes in many files without opening and closing each of them. Dr.Batcher can automatically load all recently opened files, so user doesn’t have to remember all of them.
Among other changes, in Dr.Batcher 2.2 one can meet support for automatic adding the copyright message on the top of the script, support for auto-saving scripts after the specified period of time, updated settings.
Dr.Batcher still provides users both with professional script editor and simple editor for those who don’t know batch files syntax well. The application comes with support for dozens of most commonly used DOS and Windows commands, also users can extend the list by writing their own XMLs with commands descriptions. While editing a batch file, user can switch between visual editor (Simple mode) and text editor (Professional mode) any time he wants.

Translate