• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 944
  • Last Modified:

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

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.
0
maester99
Asked:
maester99
  • 2
1 Solution
 
matriciiCommented:
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
0
 
scrathcyboyCommented:
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.
0
 
rockiroadsCommented:
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

0
 
matriciiCommented:
Yup... that would be your best bet...
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now