We help IT Professionals succeed at work.

Is it possible to create a self-extracting WinZip executable that overwrites read-only files?

maester99
maester99 asked
on
Medium Priority
1,085 Views
Last Modified: 2008-02-26
Using WinZip Self-Extractor, I have created a self-extracting executable that I plan to distribute to people, so that they can update some files on their computers.  However, when I run the executable, I get the error: "Can't create output file: <filename>", and the extraction fails.  The problem is that some of the files that I'm trying to overwrite are read-only.  Is there anyway to configure the self-extractor to ignore the file permissions (even if it involves prompting the user)?

My workaround is to have them extract to a temp directory and then copy the files using windows explorer, but I would rather avoid this workaround if possible.

Thanks in advance.
Comment
Watch Question

Commented:
Another possible workaround to exclude having users interact with the process is that you could include a batch file that would process your commands for you after extracting to the temp directory.  Such as create a folder in temp and extract the files there.  Then upon extraction, automatically execute the batch file that could either copy this directory of  your files and then they would be prompted to confirm the overwriting OR you could include in the batch file (if you know the directory they are going to be copied into) a few lines that will remove the read-only attribute of the whole directory or one file at a time (using the attrib command) and then reinstate it (also using attrib command).

If you are unsure how to do this batch, let me know and I'd be happy to help.  If you have any further questions, please write them here.

-Mat

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
I think WINRAR can ignore the file attributes, but it is not a free program, however, it will make executables like winzip.  It is slower than winzip, but more options.  But if you want to distribute a batch file with the winzip EXE, here is your solution, using the attrib.exe file distributed with windows, you need 3 files, your updatedzip.exe, attrib.exe and update.bat, as follows -

Update.bat -

attrib -R -S -H C:\yourdirectory\*.*
updatedzip.exe

- end update.bat.

Make sure the spaces are between the -R -S -H, else it not work at all.
CERTIFIED EXPERT
Top Expert 2006

Commented:
do what matricii says, in winzip self extractor, u can specify what program to run after extraction
so users extract to temp directory, self extractor runs your file you specified automatically

this file of yours, will reset permissions as described by scratchyboy
then use something like xcopy to copy directories

Commented:
Yup... that would be your best bet...
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.