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.

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
Expert in batch files programming. Exactly know how to create batch file in a fast and proper way.

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.

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.

Wednesday, February 27, 2013

Dr.Batcher 2.3 Extends Features of BAT-to-EXE Converter



The new version of Dr.Batcher, the award-winning tool to create and edit batch files, offers new features of BAT-to-EXE Converter. Now users can protect the output files with password and include folders and subfolders along with the batch file.
Dr.Batcher offers its users full-featured Batch-to-EXE conversion wizard that helps one to turn batch file into Windows executable file. User can add additional files that are needed for the batch file to run and protect the output file from reverse engineering. Now user can also protect the EXE file from an unauthorized running and include folders as well as simple files.
Among the other changes coming with version 2.3, one can meet saving the position of caret in Professional mode editor while switching between the opened files, enhanced support for different encodings in console output bar and small optimizations in batch files execution module.

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).

Translate