Wednesday, May 29, 2013

Calculate Folder Size in Batch File

It is neccessary sometimes to calculate the size of a certain folder in batch file. Though it is easy to see the size of a folder in Windows, calculating it in a batch script can be considered quite a complicated task. This small script will help you with this task:
@Echo Off
For /F "Tokens=3*" %%a In (
'Dir /-C C:\Temp ^| Find "files"') Do Echo The C:\Temp folder size = %%a
pause
Of course you should first change 'c:\Temp' to path to the folder which size you want to calculate.
We kindly remind that Dr.Batcher is the best program to create batch file, both .BAT and .CMD, try it if haven't tried it yet. 

Wednesday, May 22, 2013

Dr.Batcher 2.3.2 Is Out!

We are glad to announce Dr.Batcher 2.3.2 - the new version of award-winning tool designed to create batch files. Here is  the list  of new features and improvements in this version:
  • Highlighting labels in source code
  • Support for dragging commands from left panel to souce code in Professional mode
  • 'Never Ask Again' option in 'Delete Command' prompt in Simple mode
  • Highlihting opening and closing brackets in Professional mode
  • Lots of bugfixes
Download Dr.Batcher from official Web site.

Tuesday, May 14, 2013

Batch Files GTR and LSS: How to Compare Numbers in Batch Files

Comparing numbers in batch files is not difficult. Usually  you don't need to compare numbers in batch files very often, but sometimes  it is neccessary. What do you need to do to compare two numbers in batch file?
There are two main operators that can help you compare numbers in batch file. They are named GTR and LSS. The first command says whether the first number is greater than the second one, the second command says whether the first number is less than the second one. Here are the examples of their usage:
SET Nmbr1=100
SET Zero=0
IF %Nmbr1% GTR %Zero%   ECHO Greater than zero
Or:
SET Nmbr2=10
SET Hundred=100
IF %Nmbr2% LSS %Hundred%   ECHO Less than one hundred
You can make them nested:
IF %Nmbr2% LSS %Hundred% ( IF %Nmbr1% GTR %Zero% (ECHO  Greater than zero but less than one hundred)
We kindly remind that Dr.Batcher is the best program to create batch file, both .BAT and .CMD, try it if haven't tried it yet. 

Monday, May 6, 2013

Difference between Call and Start

You may know that you can run a program or a batch file from your own batch file with the help of commands 'start' and 'call'. Both of them are used quite often, but what's the difference between them?
'Call' command pauses the execution of your batch file until the end of working of the called program or script. You can see it by creating a test batch file with a single 'pause' command. Save this test script as 'tst.cmd' and create batch file with text 'call tst' (no quotes). You'll see that your batch file waits for the end of execution of tst.cmd.
'Start' command starts the program or script in independent mode.  Change 'call' in your batch file to 'start'. You'll see that the main batch file closes its window while 'tst.cmd' is still running.
We kindly remind that Dr.Batcher is the best program to create batch file, both .BAT and .CMD, try it if haven't tried it yet. 

Translate