It is necessary sometimes to remove files completely from a certain folder. It is handy to perform such action with the help of batch files.
Here you can find a small and useful script that might help you to clear the folder from all folders and files inside:
@echo off
echo ***Warning***
echo ***This Will Delete All Files and Folders Permanately!***
echo ***You Will Be Prompted To Confirm File Deletion...***
echo ***Verify All Files Before Deletion...***
del /P /S %1
pause
How to use this script? Save it (for example, as clearfiles.bat) and run from the command prompt with the folder to be cleaned as a parameter. For example:
clearfiles d:\Work\Old\Trash
We kindly remind that Dr.Batcher is the best program to create batch file, try it if haven't tried it yet.
Friday, April 19, 2013
Monday, April 15, 2013
Dr.Batcher 2.3.1 Is Available
We are glad to introduce Dr.Batcher 2.3.1 - the new version of award-winning tool designed to create batch file. In this version you'll find:
- Checking for existance of files in list while adding to EXE or backup
- Parsing '^' character in a right way
- Automatic update enhanced
- Lots of small bugfixes
Tuesday, April 2, 2013
Friday Bag Lunch: File Splitting and Combining
The only one who may
not like Friday is the one who has to work on Saturday. I’m not used to working
on Saturday and only fuss can spoil my Friday night. And it was fuss that I
felt as soon as I’d set foot into my flat. Don’t think that there were lots of people.
Rather! There was only my daughter, but she was getting ready for a party!!!
The light was on
everywhere, on the floor in the hall there was a hair dryer with all kinds of
combs and other dodgy things, in the nursery S60 were roaring “Death In Vegas”
at full blast, something in the bathroom was soaking, an iron was warming on
the kitchen table, all stove burners were on and something was boiling on them
while the daughter herself was sitting at the computer, with another comb stuck
in her hair.
“Hi!” – I shouted.
“Your hands around my
throat” – the “Vegas” answered.
I felt like running out
into the landing and killing the power supply at one go...
...If I had called my
friends in time and our plan to go to play billiards hadn’t been ruined, then..
“Hi, Dad!” I heard a
voice behind my back, turned around and was petrified. Have you ever tried to
look a person in the eyes when these eyes are totally different?
“What’s wrong with
your eye?”
“Which one? The
painted or the other one?”
“I see.”
“If you’re hungry,
salads will be ready soon and you can help yourself a bit”
“What do you mean:
help yourself a bit?”
“I’ll take the rest with me. The girls told me to cook salads”
“I’ll take the rest with me. The girls told me to cook salads”
I needed to hide
somewhere! The only thing I could do is to lock myself up in my room and turn
the TV on.
“Dad, will you help me
with burning a video CD?”
“What do you mean:
help you? You know how to burn CDs”
“But it’s too large –
almost 2 gigabytes. It needs to be written on 2 CDs and I don’t know how to do
it.”
I had no thought of
teaching my daughter in such conditions, but I’d nowhere to go.
Having seated myself
at the computer and on legal grounds turned the music off, I started working my
salads off.
“Actually, it’s a very
simple task. You can split a movie into parts by Total Commander. But there
might be problems with putting these parts together.
“Daddy, you’re so
clever! What problems you may have?”
“Not me, but you! Or
the one who is in charge of computers at your party.”
“Rick is. And it was
he who asked me to bring this movie. He’s always good at everything. You just
help me burn the film, and he’ll puzzle everything out.”
“I doubt it. I’ve seen
these know-alls. To know how to solve a problem you have to face it once at
least.”
“And what kind of
problem it may be?”
“The question is if he
has Total Commander on his computer. If he has, then it won’t be difficult to
reassemble the movie. If he doesn’t have Total Commander, then it will be hard
for me to explain to him, and especially to you, how to do this. The only
option is to write a detailed instruction down on a sheet of paper or into a
text file.
“Daddy, you’re great!
Of course, do it! And I’ll go into the kitchen to get the salads done”.
“That’s a heck of a
lesson.”- I thought. “You teach me here and I’ll go do other things...”
The music started
booming again, but I had nowhere to go and got down to my work. But in order
not to return to this question, I decided to make up not a brief but a detailed
instruction for my daughter and her friend. That’s what came out.
File splitting and combining
File splitting may be
necessary in cases when the size of a storage medium (a floppy disk, CD...) is
smaller than the size of a file. We will carry out this operation by Total
Commander. It’s a good idea to move the file into a different folder (so that a
novice user will see the result of the operation) and open it both in the left
and the right windows (otherwise the parts will be copied to the folder opened
in the opposite window). Select the file (or just place the cursor on it) and
choose “Split File” in the “File” menu (fig. 1). Then choose the size of the
parts (in our case – matrixes of 700 Mb each) and click “Ok”. In the folder you
will see the files of the parts (their extensions will be .001, .002, ...) and
a .crc-file containing the information about the source file (its name, size
and checksum).
It’s better to copy all
the three files to the matrixes. Free space is more likely to be on a disk with
the last part, so you may write the crc-file just there.
File combining
After copying all the
files to a hard drive of another computer, to combine them with the help of
Total Commander you just need to press Enter on the .crc file or choose
“Combine” in the “File” menu. In doing so the file will be combined in a folder
opened in the opposite window.
Failing Total
Commander on your computer, you can combine the file out of its parts by using
the copy function in command line or create a bat-file (a batch file which will
contain the same copy command.)
Copy command settings
The copy command will
be as follows:
copy /b movie.001 +
movie.002 movie.avi
(The key /b means
binary copy).
And it is this line
that is obligatory in a bat-file.
The bat-file can be
run directly from the explorer.
Bat-file creation
You can create a
bat-file in Total Commander by pressing the buttons “Shift” + F4” or in a
simple Notepad. When naming the file, you must change its extension into .bat. But the most comfortable way to create batch file is tool called Dr.Batcher.
This file will consist
of only one line with a copy command (see above).
I reread the text once
again. All details seemed to have been mentioned, but somehow I thought it
would be right to write the finished bat-file to the second matrix along with the
instruction. That would be more effective. Friday night is not the best time
for study. Especially, at parties.
I left the computer to
burn the CD and went to tell my daughter about the result of my work. Having
heard the welcome news, she flashed a glance at me with the
already-equally-painted eyes and said, shouting the hair dryer down:
“Thanks, Dad! Maybe
you’ll burn for me some music too?”
“No way, you can deal
with it by yourself, and I’ll go eat your salads”.
The salads were
delicious, and the mood suited the Friday night again.
Roger Vadey,
Monday, March 25, 2013
Clean AVG Temporary Files via Batch File
AVG is a great free antivirus quite popular among the users of Dr.Batcher. You can find it here. But as every software, it leaves sometimes some temporary files that should be cleaned manually by its user. Batch files are the best way to clear AVG temporary files.
Here is a small batch file that will help you to clean AVG temporary files:
CD "C:\Program Files (x86)\AVG\AVG8\"
avgcfgex.exe /command=19
CD C:\ProgramData\avg8\scanlogs
DEL C:\ProgramData\avg8\scanlogs\*.* /s /q
MD C:\ProgramData\avg8\scanlogs
CD C:\ProgramData\avg8\update\backup
DEL C:\ProgramData\avg8\update\backup\*.* /s /q
MD C:\ProgramData\avg8\updata\backup
ECHO Successfully Deleted All AVG Temp Update Files...
PAUSE
We kindly remind that Dr.Batcher is the best program to create batch file, try it if haven't tried it yet.
avgcfgex.exe /command=19
CD C:\ProgramData\avg8\scanlogs
DEL C:\ProgramData\avg8\scanlogs\*.* /s /q
MD C:\ProgramData\avg8\scanlogs
CD C:\ProgramData\avg8\update\backup
DEL C:\ProgramData\avg8\update\backup\*.* /s /q
MD C:\ProgramData\avg8\updata\backup
ECHO Successfully Deleted All AVG Temp Update Files...
PAUSE
We kindly remind that Dr.Batcher is the best program to create batch file, try it if haven't tried it yet.
Friday, March 22, 2013
Windows Scripting Technologies: Create Batch File vs. Write in Other Scripting Languages
Introduction
So
what is special about these technologies that they should be looked at
separately? Frankly speaking, the answer to this question lies in the title of
this article; being the most popular operating system, Windows gets special
attention from its users.
Although
script technologies are often cross-platform, it doesn’t down-grade their
interest, value and attractiveness. I’d rather say, the situation is even quite
opposite. But let’s not run before the hounds and speak about the technologies
themselves. And after that we’ll classify them and decide what exactly in each
of them troubles the user.
Batch files
Batch files were the
pioneers among script technologies available for Windows-users. Specifically,
they became available even before the creation of Windows, in DOS-deep times.
And as POSIX system fans like to notice nowadays, their founding fathers were
aspired by the shell scripts that have become wide-spread in UNIX.
Nevertheless, it’s not that important to know what exactly inspired the
programmers to create such a popular and useful technology which made the
users’ lives easier in the times when fast typing was a vital skill for
everyone.
The years went by. Batch files became obsolescent, and Windows
developers offered more powerful and more sophisticated script technologies.
But none of them could fully substitute batch files. Why? Batch files
are thought to be a live continuation of command line which is used both by
simple users and system administrators. That is why the Microsoft corporation
is still releasing command line utility suits that can be used in batch files automation, and it doesn’t plan
to put out batch files support in
its future system versions to promote more powerful and advanced technologies.
Nowadays, batch files have a number of advantages over
other script technologies. First, it’s easy to create them. Actually, providing
that you’re not trying to solve a tricky problem with batch files, the batch file
itself consists of ten lines where you write commands or call command line
utilities. Anyone can create batch file, and if you use some specific utilities
like Dr. Batcher (http://www.drbatcher.com) the whole process becomes even simpler.
The second advantage is its portability. If you don’t use specific commands or
utilities that work only under certain system versions, your batch file can run in all Windows versions. But of course, if to try implementing complex
automation with batch files, you can
be disappointed as they’ve been designed for solving comparatively small
automation problems.
KiXtart
This
script language was developed by a member of the dutch Microsoft division and
initially was designed to automize the users’ work with Microsoft LAN Manager.
But much water has flowed under the bridges since then and today KiXtart (www.kixtart.org) is a totally independent script language that interacts with
COM-objects and, therefore, with such COM-based technologies as ADSI, ADO, and
WMI. One of the most pleasant things of KiXtart is its FiXforms library which
gives you the possibility of creating a fully functional graphical user interface.
Moreover, opposed to batch files,
KiXtart was initially tailored for more complex tasks and, therefore, it can
carry out custom functions that are wide-spread over the Internet. So among the
major advantages of this technology are GUI support, and a flexible combination
of simplicity and power that attracts both real users and system
administrators.
Active Scripting
In
contrast to KiXtrat, this technology implies the use of completely different
programming languages and natively proposes VBScript and Jscript. Usually the
end-user deals with Active Scripting using the possibilities of Windows Script
Host (WSH). First it appeared in Windows’98 and has been used very actively
since.
Of
course, Active Scripting provides broader options than batch files. Languages used in script
writing handle with objects and give access to COM-based technologies. With WSH
you can use login-scripts, manipulate the registry, and do a lot of other
useful and interesting things. It isn’t that you can’t do all this with batch files, but by using Active Scripting
you don’t have to bend your mind that hard. And also it doesn’t require deep
knowledge of both the language and other third-party tools.
In
addition to VBScript and Jscript, Active Scripting supports other languages used
in other platforms and popular among Windows system administrators. I’m sure
you’ve heard of such software programmes as ActivePerl, ActivePython,
ActivePHP... Yes, they are the very implementations of well-known script
programming languages compatible with Active Scripting. This feature of Active
Scripting technology happens to be the most attractive as everyone has their
own preferences in the context of programming languages, and such kind of
democracy that let you use your favourite language is definitely heartily
welcomed by users.
As
for the tools that make possible script writing over Active Scripting, there
are lots of them. And each programming language has its own tools. As the most
popular scripting language for Active Scripting is the Windows native VBScript,
then most applications you’ll find will be VBScript applications. To my mind,
one of the most handy editors is VBSEdit. But of course it doesn’t mean that some
another similar software product won’t suit your taste.
Windows PowerShell
Just as Active
Scripting replaced batch files (well, it didn’t fully replace them; it’s rather
become a more powerful and professional add-on), so too PowerShell changed
Active Scripting. Microsoft actively promotes a new script technology and it
has acquired quite a good reputation among users and system administrators.
While Active Scripting
is COM-based, in PowerShell the next generation of Microsoft technologies is
used, that is .NET. Among PowerShell scripts you can turn to .NET instances
just as you turned to COM objects. By the way, it doesn’t mean that you can’t
use COM objects anymore. PowerShell scripts are based on cmdlets. Practically,
these are small sections of a code or even complete programmes that implement
some located and separate task. Despite their essence, cmdlets can be of a
different nature. Some of them may be Windows native program files, others –
PowerShell scripts or even COM- and .NET –objects methods.
All in all, PowerShell
does have a number of significant advantages over Active Scripting. In some way
these advantages are provided by .NET platform and Microsoft .NET Framework
libraries, and in another they lie in the possibilities
of PowerShell script platform itself. On
the whole, we can say that PowerShell successfully pushes VBScript and other
languages out, but it isn’t likely to completely replace batch files as they are in different leagues and
go together quite peacefully.
What concerns tools for editing PowerShell scripts,
they are also numerous. Besides already mentioned AdminScriptEditor, there
exist such tool as PowerShellAnalyzer and PowerGUI.
Other script technologies
Certainly, there are other
non-specific for Windows script technologies which are popular among system
administrators and users to this or that degree. Some of them also transferred
from other platforms but were not of interest to ActiveState company that
adjusted many script languages to Active Scripting. Some of them were created
by enthusiasts and commercial companies… So, there are lots of script
technologies and we can’t look at all of them. We’ll just name them but won’t
go into details.
Summary
So which one of Windows script
technologies is the best? It’s difficult to say. Even after enumerating the
peculiarities each of them. It is because they are rather different, and each
one has its own advantages and disadvantages. It’s irrational to automize a
simple task with Windows PowerShell, but it’s silly to turn to batch files for
a complex automation either. So we can say that each technology is appropriate
in its own field of use.
Roger
Vadey
Monday, March 18, 2013
How to Merge Two Files with Help of Batch Script
Imagine: you have some spiltted files and you want to merge them into the new file containing all of them. Of course, it is much simpler to perform this operation using a small batch script instead of copying data manually. Here you can see an example of this batch script (hope, it'll be quite understandable with the comments):
REM Advanced Files Merger
REM Adds files specified by mask to the end of the file passed as the first parameter
REM Masks or names of files to be added are passed as the second, the third, etc. parameters
REM E.g. usage is like: merger FileToBeExpanded.bin *.exe *.zip *.*
@ECHO off
IF '%1=='LooP GOTO %2
SET prgname=%0
SET destfile=%1
IF '%2==' GOTO done
IF not EXIST %2 GOTO done
:_loop
SHIFT
IF '%1==' GOTO done
FOR %%i in (%1) do CALL %prgname% LooP addfile %%i
GOTO _loop
:addfile
type %3>>%destfile%
echo.>>%destfile%
:done
We kindly remind that Dr.Batcher is the best program to create batch file, try it if haven't tried it yet.
REM Adds files specified by mask to the end of the file passed as the first parameter
REM Masks or names of files to be added are passed as the second, the third, etc. parameters
REM E.g. usage is like: merger FileToBeExpanded.bin *.exe *.zip *.*
@ECHO off
IF '%1=='LooP GOTO %2
SET prgname=%0
SET destfile=%1
IF '%2==' GOTO done
IF not EXIST %2 GOTO done
:_loop
SHIFT
IF '%1==' GOTO done
FOR %%i in (%1) do CALL %prgname% LooP addfile %%i
GOTO _loop
:addfile
type %3>>%destfile%
echo.>>%destfile%
:done
We kindly remind that Dr.Batcher is the best program to create batch file, try it if haven't tried it yet.
Tuesday, March 12, 2013
How to Find Desktop from Batch File
Sometimes it is necessary to operate with some files on desktop. It is easy to find a desktop itself :), but how to get the path to from a batch script? Here is a small bath script that might help you with this task.
ECHO chcp 1251 > 11.cmd
FOR /f "skip=4 tokens=2,*" %%i in ('reg query "HKCU\software\microsoft\windows\currentversion\explorer\shell folders" /v desktop') do ECHO set desktop=%%j >> 11.cmd
ECHO chcp 866 >> 11.cmd
CALL 11.cmd
ECHO %desktop%
As far as you can see, we retrieve the desktop location from Windows registry. The only trick is to process characters in different encodings, thus we need to create a temporary batch file.
We kindly remind that Dr.Batcher is the best program to create batch file, try it if haven't tried it yet.
ECHO chcp 1251 > 11.cmd
FOR /f "skip=4 tokens=2,*" %%i in ('reg query "HKCU\software\microsoft\windows\currentversion\explorer\shell folders" /v desktop') do ECHO set desktop=%%j >> 11.cmd
ECHO chcp 866 >> 11.cmd
CALL 11.cmd
ECHO %desktop%
As far as you can see, we retrieve the desktop location from Windows registry. The only trick is to process characters in different encodings, thus we need to create a temporary batch file.
We kindly remind that Dr.Batcher is the best program to create batch file, try it if haven't tried it yet.
Subscribe to:
Posts (Atom)






