1.

Solve : Unzipping to a temporary file and open and delete it?

Answer»

Dear all,

I'm a newbee or a noob with programming.

I need a BATCHFILE wich does the following:

- Unzip a file from a zipfile (using winzip32.dll)
- the unzipped file must be a temporary file
- the unzipped file must be opened in Excel
- after closing the tempfile... the file must be deleted

Until now I found this code/files on internet:

filename: CreditDB.vbs
containing the following code which unzips the file:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
strZipFile = "path\Some zip-file.zip"'name and path of zip file, which CONTAINS only 1 file: Some excel-file.xls
outFolder = "C:\temp" 'destination folder of unzipped files


'Create the required Shell objects
Set objShell = CreateObject( "Shell.Application" )

'Create a reference to the files and FOLDERS in the ZIP file
Set objSource = objShell.NameSpace(strZipFile).Items()

'Create a reference to the target folder
Set objTarget = objShell.NameSpace(outFolder)

intOptions = 256

'UnZIP the files
objTarget.CopyHere objSource, intOptions

'Release the objects
Set objSource = Nothing
Set objTarget = Nothing
Set objShell = Nothing
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

CreditDB Launcher.bat
containing the following code to open the unzipped file:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

cscript //nologo "path\CreditDB.vbs" 'name and path to vbs-file (see above)

START EXCEL.EXE "C:\temp\Some excel-file.xls" 'path and name of unzipped file (see above)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

The problem is, that the unzipped file may only be veiwed by the user that unzipped it. But when one unzips a file to C:\temp that everyone else who logs onto the PC can view this file form C:\temp. So, I need the code to delete the file after it has been closed, but I don't have a clue where to start.

Hope SOMEONE can help me



Discussion

No Comment Found