ASP automatically extracts the RAR file in the server

xiaoxiao2021-03-05  19

In fact, you want to achieve this feature very simple. First, you need to upload a RAR's decompression program, which is Rar's own decompression program, just need its core.

The file Rar.exe can be. Then you have to upload a program cmd.exe that executes rar.exe is the program in Windows (don't you have to say more). Finally, these programs are started. Look at the following code

<%

Dim Ylj, Ywj, Mlpath, Shell, Rarcomm, Retcode, CMD, Comm, FSO

Mlpath = "e: / page / mian /" 'Store Rar.exe and Cmd.exe path

YLJ = Server.mappath ("Mian") & "/" 'Different the path placed after the file

YWJ = Server.mappath ("Mian / Apathy.rar") 'To decompress the RAR file

Set shell = server.createObject ("wscript.shell")

RARCOMM = "E: /Page/mian/cmd.exe / c" & mlpath & "rar.exe x -t-= -p-"

Cmd = RARCOMM & YWJ & "& ylj

Retcode = shell.run (cmd, 1, true)

%>

That is to use server.createObject ("wscript.shell") to perform cmd.exe to run the RAR.exe file to extract the RAR file.

转载请注明原文地址:https://www.9cbs.com/read-38729.html

New Post(0)