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

Posted on 2006-03-31
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.
Question by:maester99
    LVL 2

    Accepted Solution

    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.

    LVL 44

    Expert Comment

    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\*.*

    - end update.bat.

    Make sure the spaces are between the -R -S -H, else it not work at all.
    LVL 65

    Expert Comment

    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

    LVL 2

    Expert Comment

    Yup... that would be your best bet...

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
    Article by: Rob
    Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
    The viewer will learn how to create multiple layers to apply various filters and how to delete areas from each layer’s filter.
    Using Adobe Premiere Pro, the viewer will learn how to set up a sequence with proper settings, importing pictures, rendering, and exporting the finished product.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now