Author: Wang Haixuan e-mail: wanghaixuan@lianchuang.com
Automatic download of online programs with WinRAR
Nanjing Wang Haixuan
summary:
This article explains how to use WinRAR's self-demired function to implement the automatic download of online programs. The so-called "automatic" is that the user has no sense, and the program is already installed on the computer. Of course, if this function is used for unfair ways (such as manufacturing viruses, Trojans), it is not the purpose of this article.
I. Introduction
The author encountered a problem when it is an online application process for a tax bureau: how to automatically update the app on the local machine. Because, if you are prompted to save when the company is updated, you don't know what to do if you are prompted when you're available. Moreover, local client programs should be communicated with the server. For security reasons, they don't want them to know where the program is. That is, the user does not know where the program is downloaded, and only let the program automatically downloads to a place to machine, if the server-side program version is updated, download the update client again.
I have seen an article about "Web Trojans" on the Internet, how is it unknowing the program (Exe program) to the user's computer. The author thinks that if I pack the program you need to download into an executable program, wait until the program is downloaded to the client, and the above requirements can be achieved. After contrast, I chose WinRAR compression tool.
WinRAR not only has high compression ratio, but it can easily make automatic uncompressed EXE file packages. In addition, through a "annotation file" (RAR compression package dedicated .txt file), you can also set the target path to decompress the download, create shortcuts, version information, etc. Thereby achieving automatic, concealed, fast, foolified installation procedures to user desktops.
Second, the program is realized
1, WinRar introduction
WinRAR is a 32-bit Windows version of RAR Compressed File Manager - a powerful tool that allows you to create, manage, and control compressed files. From the command line, you can also run the WinRAR command, and the regular command line syntax is as follows:
WinRAR
Detailed command, switch and other parameters to visit WinRAR assistance, the author uses WinRAR3.11 Chinese version.
2, create WinRAR self-extract files
l Create a C: / Test folder (here only testing, you can create anywhere).
l Create a WeTaxClient directory in C: / Test, placing programs that need to package them.
l Create a Test.bat batch file.
Edit Test.bat file, type:
C: /Progra ~ 1/winrar/winrar.exe a -sfx -ep1 -ag -m5 WebTax C: / Test / WebTaxClient
REM Add Note
C: /Progra ~ 1/winrar/winrar.exe c: / test/inf.txt C: / test / *. EXE
My computer is installed under C: / Program files, you can modify the above depending on the situation.
l Create Inf.txt.
The Inf.txt content is as follows:
Title = XXX National Taxation Bureau Online Declaration System 2003
TEXT
{
Some system descriptions and copyright information, etc. ...
}
PATH = C: / Program Files /
SavePath
Setup = c: /progra ~1/webtax ~ 1/Message.exesilent=1
Overwrite = 1
Shortcut = D, C: / Program Files / WebTaxClient / Login.htm, XXX National Taxation Bureau Online Declaration System 2003, Online Declaration System 2003
The above is exiled from the actual project. Among them, the important parameters are:
PATH represents the decompression target path;
Setup indicates the program that runs first after the decompression is completed. Here, Message.exe is our for friendly reminder users, specially written a program to prompt "program update!". This file is not possible.
When Silent is set to 1, the WinRAR window is not displayed, which can be decompressed.
Whether OverWrite covers the original program file, set to 1.
Shortcut creates shortcuts in the user desktop
3. Make the test page file (TEST.HTML).
Test.html is as follows:
HEAD>