Powershell to unzip file having passowrd

hi, i am using the following script to unzip files it works fine with files not having password
$shell=new-object -com shell.application
$CurrentLocation=get-location
$CurrentPath=$CurrentLocation.path
$Location=$shell.namespace($CurrentPath)
$ZipFiles = get-childitem *.zip
$ZipFiles.count | out-default
foreach ($ZipFile in $ZipFiles)
$ZipFile.fullname | out-default
$ZipFolder = $shell.namespace($ZipFile.fullname)
$Location.Copyhere($ZipFolder.items())
# for password protected file it pops up a windows saying password needed, how can i enter the password in script
#what changes i need to make if i have to extract password protected files.
student

AFAIK, you can't do passwords directly with WScript.  You may be able to code up a method to imitate key strokes though.
My suggestion would be to call another command-line utility zip/unzip program like 7-zip:
http://www.7-zip.org/download.html

Similar Messages

  • How to unzip files, how to unzip files

    How do I unzip  files on my mba 11 inch?  I was told to use archive utilites but I can't find it.

    I am having the same problem.  I downloaded 5 Smilebox slideshows and downloaded the installer as instructed when I tried to open the files.  None open, with DiskImageMounter and Disk Utility.  Each time I get the installer instructions.

  • Unzipping files - works, but need some hlp to make it better

    Hi there!
    I am trying to unzip files using java.util.zip
    My code works If I have a parent directory for all files/folders.
    So when I unzip the structure is as -
    zipFileName -> parent folder -> child files/folders
    where, zipFileName and parent folder names are same.
    But I want to have it as
    parent folder -> child files/folders.
    Here is my code :
    public void unzipFiles(String zipFileName, String zipFolderPath, String unzipPath) {
    Enumeration entries;
    ZipFile zipFile;
    try {
    //Set up a directory name for the unzipped files
    String courseFolderName = zipFileName.substring(0, zipFileName.indexOf("."));
    //Get the zip file from its location in the "zip" folder on theServer
    String separator = File.separator;
    zipFile = new ZipFile(zipFolderPath + separator + zipFileName);
    //Set up the directories in the data store
    entries = zipFile.entries();
    while (entries.hasMoreElements()) {
    ZipEntry entry = (ZipEntry)entries.nextElement();
    if (entry.isDirectory())
    String dir = entry.getName();
    System.out.println("entry :"+unzipPath + separator + courseFolderName + separator + dir);
    checkFilePath(unzipPath + separator + courseFolderName + separator + dir);
    unzippedFolders.addElement(courseFolderName + separator + dir);
    //Add the unzipped files to the data store
    entries = zipFile.entries();
    while (entries.hasMoreElements()) {
    ZipEntry entry = (ZipEntry)entries.nextElement();
    if (entry.isDirectory())
    continue;
    if (debug)
    System.out.println("Extracting file: " + entry.getName());
    copyInputStream(zipFile.getInputStream(entry),
    new BufferedOutputStream(
    new FileOutputStream(unzipPath + separator + courseFolderName + separator + entry.getName())));
    zipFile.close();
    catch (IOException e) {
    e.printStackTrace();
    catch (Exception e) {
    e.printStackTrace();
    [\code]
    The above code works if the zip file is having all files under a parent folder:
    zipFileName -> parent folder -> child files/folders
    sample output:
    unzipping the files...
    entry :C:\DataStore\template\test2/IMAGES/
    Creating directory C:\DataStore\template\test2/IMAGES/
    entry :C:\DataStore\template\test2/INPUTS/
    Creating directory C:\DataStore\template\test2/INPUTS/
    otheriwse, if I have no levels under my zip level, I get an error like this:
    unzipping the files...
    Extracting file: schedule.htm
    Extracting file: IMAGES/AMTC.GIF
    java.io.FileNotFoundException: C:\DataStore\schedule\IMAGES/AMTC.GIF (The system
    cannot find the path specified)
    Can somebody pls help me find out where I am going wrong. Any help would be really really great.
    Thanks
    -Mahi                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

    I don't know if this will help but... If I understand correctly, is not
    recreating the correct directory tree?
    // unjar the jar to the destination directory destdir
    // destdir = c:\mydir\ is prepended to each jar entry
    JarFile jarFile = new JarFile( "myjar.jar" );
    Enumeration e = jarFile.entries();
    while( e.hasMoreElements() )
    JarEntry entry = (JarEntry)e.nextElement();
    File localFile = new File( destdir + entry.getName() );
    ---> // peel off the parent path and make as directories
    ---> File directory = new File( localFile.getParent() );
    ---> directory.mkdirs();
    // these can be inlined if desired
    FileOutputStream fileOutputStream = new FileOutputStream( localFile );
    BufferedOutputStream bufferedOutputStream = new BufferedOutputStream( fileOutputStream );
    copyInputStream( jarFile.getInputStream( entry ), bufferedOutputStream );
    jarFile.close();

  • Unzipping Files in the wrong folder

    Hi
    I am trying to unzip files. It works fine except that it unzips the files at the root. So i have tried specifying the path for making the directory (in which the unzipped files are stored). But that doesnt seem to work. Now i am unable to find the unzipped files. CAN ANYONE HELP PLEASE
    public static void unzipFile(String zFile)
            Enumeration entries;
            ZipFile zipFile;
           try {
                zipFile = new ZipFile(zFile);
                File file = new File(zipFile.getName());
                String fname = file.getName();
               String substr1 = fname.substring(0, fname.indexOf("."));
                String filepath = "/data/psawant/temp";
                File dir = new File(filepath, substr1);
                try {
                        dir.mkdir();
                catch (Exception fe)
                      System.err.println("Unhandled exception:");
                        fe.printStackTrace();
                        return;
                entries = zipFile.entries();
                while(entries.hasMoreElements()) {
                    ZipEntry entry = (ZipEntry)entries.nextElement();
                    if(entry.isDirectory())
                         // Assume directories are stored parents first then children.
                        System.err.println("Extracting directory: " + entry.getName());
                                          (new File(entry.getName())).mkdir();
                        continue;
                    } //end of if
                    System.err.println("Extracting file: " + entry.getName());
                    copyInputStream(zipFile.getInputStream(entry),
                        new BufferedOutputStream(new FileOutputStream(entry.getName())));
                 } //end of while
                zipFile.close();
                   } catch (IOException ioe)  {                 }
             } //end of unzip function
    public static final void copyInputStream(InputStream in, OutputStream out)
        throws IOException
            byte[] buffer = new byte[1024];
            int len;
            while((len = in.read(buffer)) >= 0)
            out.write(buffer, 0, len);
            in.close();
            out.close();
    Any help is apprciated
    Thanx

    Sorry I got it this time. I had overlooked the new File. I added that & it works fine but there seems to be some problem
    If the folder has another folder inside . it doesnt show that one. or rather just unzips one folder & no folders inside it. But i guess i can check for that
    Thanx for u r help
    Have a nice day

  • Suggest me the link to any Pdf file having form builder process flowcharts

    Hi people,
    In form builder 6i ,in help topics, i find "process flowcharts" describing various default process of form builder is there. I want to take it printout. But first what i have to do is copy it into microsoft word and then
    format the same etc it is time consuming.
    Can any body suggest me if there is any pdf file having such process flowcharts. If such pdf file is there then please tell me the link.
    thanks in advance
    prasanth a.s.

    Prashant,
    think this is a duplicate. However, look at the online help.
    Frank

  • Reading XML file having various foreign languages from web application.

    Greeting..
    I'm dealing with a so-called serious problem where-in:
    I've to read one of the configuration files(XML files) having values in different foreign languages (like Chinese, Japanese, Arabic etc). I've to read that file contents, in as it is form, in such a way that user can read / change the data from the web application.
    I'm showing the XML file inside the TextArea (the HTML <textarea> tag. While reading this file, it got converted to junk values instead of actual ones. While saving this file it changes those original values to junk in file as well.
    I'm using SAX parser with DefaultHandler.
    Better suggestions are welcome.
    Thanks in advance
    Regards

    rikslovein wrote:
    Better suggestions are welcome.You have a number of places where data corruption could occur. You have not yet identified where it occurs. When you know where it occurs it would be much easier to determine a solution.
    Do NOT display the characters to determine the problem. Instead take a small sample and print the numeric values. And do that at each stage/layer until they do not match.

  • UNZIP file from ABAP

    Hi,
    I have a requirement to retrieve a zip file from the FTP Server, unzip it to the SAP Server and process the unzipped files. Retrieving the data from the FTP server should work via FTP commands which can be executed from within an ABAP program. However, the problem is unzipping these files via ABAP and put them on the server as well. 1. How to do this from within an ABAP Program? (unix commands?)
    2. Can I unzip these files with or without using the folder structure? (additional parameter for unix command?)
    Kind regards,
    Micky.

    REPORT ZTESTUNIX line-size 400
                    no standard page heading.
    selection-screen begin of block ucmd with frame title text-001.
    parameters: unixcom like   rlgrap-filename.   " ...SAP Interface file
    selection-screen end of block ucmd.
    data: begin of tabl occurs 500,
            line(400),
          end of tabl.
    data: lines type i.
    start-of-selection.
      refresh tabl.
      call 'SYSTEM' id 'COMMAND' field unixcom
                    id 'TAB'     field tabl[].
      describe table tabl lines lines.
      loop at tabl.
        write:/01 tabl-line.
      endloop.
      skip 2.
      if lines = 0.
        write:/ 'NO Occurances were found'.
      else.
        write:/ 'Command was successfully executed' color col_total.
        write:/ 'Number of entries in Search' color col_total,
                 lines color 6.
      endif.
    end-of-selection.
    while running give the command as
    <b>unzip test.zip  -x dir</b>
    then it will unzip test.zip file to dir called dir.
    you can specify the filepath instead of file...
    regards
    vijay

  • How to read ZIP files(having PDFs,Image) using MQ Series link for R/3

    Hi,
    1)Is it possible to transfer a zip file (having an image or pdf) using IDocs in SAP 4.6C using MQ Series link for R/?
    Scenario: "MQ Series link for R/3" converts Business-Reports from a third-party software,into SAP IDocs.Each Business-Report contains one XML file and one ZIP file.
    2)Being on ABAP side,do I have to worry about how the zip file would be converted into IDocs?
    Detailed descrption:
    This scenario requires integration of a non-SAP software which talks in XML with SAP R/3(4.6C).The customer has decided to go with 'MQ Series link for R/3' (which integrates any non-SAP application running on IBM MQ Series to R/3,by converting data(in any format) into IDocs).He is not ready to go for XI.
    The Problem area is a functionality which requires the non-SAP software to send XML file along with an attached Zip file.So,XML document,basically,has a 'zippedFile' XML element having actual file in XML keyword 'file'.
    This XML document ideally, should be converted by the subsystem(MQSeries link for R/3) into IDocs i.e. into a stream which could be stored in a table on R/3 side and later, sent back to the non-SAP software through MQ Series link to be converted into zip-file again with corresponding pdfs,images.I want someone who has worked in a similar scenario to confirm this.

    Hi,
    I have a feeling I have posted this question in the wrong forum or maybe I will let you decide this.Any help would be appreciated (even the right forum name).
    My scenario requires integration of a non-SAP software which talks in XML with SAP R/3(4.6C).The customer has decided to go with 'MQ Series link for R/3' (which integrates any non-SAP application running on IBM MQ Series to R/3,by converting data(in any format) into IDocs).He is not ready to go for XI.
    The Problem area is a functionality which requires the non-SAP software to send XML file along with an attached Zip file.So,XML document,basically,has a 'zippedFile' XML element having actual file in XML keyword 'file'.
    This XML document ideally, should be converted by the subsystem(MQSeries link for R/3) into IDocs i.e. into a stream which could be stored in a table on R/3 side and later, sent back to the non-SAP software through MQ Series link to be converted into zip-file again with corresponding pdfs,images.I wanted someone who has worked in a similar scenario to confirm this.

  • I like to edit single letter in the pdf file having more then 1000 page, Example "T" in place of "V" in all the 1000 pages in pdf file. Please let me know

    I like to edit single letter in the pdf file having more then 1000 page, Example "T" in place of "V" in all the 1000 pages in pdf file. Please let me know !

    In a PDF you can´t change single letter.
    You can only try to convert the PDF document into a Word document.
    Now you can search and replace a letter.

  • Howto deal with multiple source files having the same filename...?

    Ahoi again.
    I'm currently trying to make a package for the recent version of subversive for Eclipse Ganymede and I'm almost finished.
    Some time ago the svn.connector components have been split from the official subversive distribution and have to be packed/packaged extra. And here is where my problem arises.
    The svn.connector consists (among other things) of two files which are named the same:
    http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/features/org.polarion.eclipse.team.svn.connector_2.0.3.I20080814-1500.jar
    http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/plugins/org.polarion.eclipse.team.svn.connector_2.0.3.I20080814-1500.jar
    At the moment makepkg downloads the first one, looks at its cache, and thinks that it already has the second file, too, because it has the same name. As a result, I can neither fetch both files nor use both of them in the build()-function...
    Are there currently any mechanisms in makepkg to deal with multiple source files having the same name?
    The only solution I see at the moment would be to only include the first file in the source array, install it in the build()-function and then manually download the second one via wget and install it after that (AKA Quick & Dirty).
    But of course I would prefer a nicer solution to this problem if possible. ^^
    TIA!
    G_Syme

    Allan wrote:I think you should file a bug report asking for a way to deal with this (but I'm not sure how to fix this at the moment...)
    OK, I've filed a bug report and have also included a suggestion how to solve this problem.

  • Unable to unzip files , unable to move apps into the app foldercant update

    I cannot unzip files. Also if i try to install a new app by dragging it to the applications folder it says "that files already exists".
    also if i try to update with software update it gives an error. i tried running verify disk permissions and repair disk permissions but this did nothing please help i am scared cuz my last time machine was along time ago.

    Not to worry.
    A few clarification questions first.
    What exactly does the dialog say when you try to drag a new app to the applications folder? Is it something like, "an older version of this already exists in this location, do you want to replace it with the version you are moving?"
    And, what application are you attempting to use to unzip files?

  • Problem with unzipping file

    I am trying to unzip a file using java.util.zip. It is throwing a ZipException in the first line where I instantiate ZipFile object.
    ZipFile oFile = new ZipFile("/myzip.zip");java.util.jar is not working either. It fails right here:
    JarFile oFile = new JarFile("/myzip.zip");Here is the exception thrown in the above cases:
    java.util.zip.ZipException: error in opening zip file
            at java.util.zip.ZipFile.open(Native Method)
            at java.util.zip.ZipFile.<init>(Unknown Source)
            at java.util.jar.JarFile.<init>(Unknown Source)
            at java.util.jar.JarFile.<init>(Unknown Source)
            at ReadZipFile.main(ReadZipFile.java:21)
    An interesting observation:
    I am able to extract the contents of the zip from the command-line using jar utility.
    jar xvf myzip.zipI am stumped! I think jar utility internally uses the same classes for unzipping files. How come it is working with jar utility whereas it is not working from Java program? Also, the myzip.zip appears to be a valid archive - I am able to open it with winzip.
    Any pointers will be appreciated.
    Thanks in advance,
    Ganesh

    I think the above reply is correct but didn't explain why you would be getting a file not found. Unless you have your zip file at the root of your harddrive the slash in the filename is improper. Without the slash your code will assume your current working directory and look for the file there.
    By putting that forward slash in there you are telling the code to look at the root of the filestructure and NOT at the current working directory.

  • Unzip file from froms then load

    i have form (basically called loader) which read text file and then load it in data base.
    Now,there is a user requirement that if text file is in zip format then he can unzip file using form.
    Any idea how to do this can some unzip software used at back end.
    I mean any idea any suggestion is required.
    Forms 6i i am using.

    The zip.exe and unzip.exe are shipped with Oracle products, they are found under %ORACLE_HOME%/bin
    just type zip or unzip in a command line session and you'll get all the switches and details.
    Judging from your first post I understand you are running in C/S mode, if not you need to use CLIENT_HOST from webutil instead of HOST. It's the same concept.
    As for HOST built-in example, I told you, there are very nice and detailed examples in the online help of Forms builder.
    Open Forms builder and either press Ctrl + H or click on the big blue question mark, or open help menu and click on "Online Help".
    Tony
    Message was edited by:
    Tony Garabedian

  • Unzip files from a folder which is updating regularly using multithreading

    Hi All,
    I have acode which unzip all the files from a folder .This code picks up all the zipped files at a time and then unzip it and write them to another folder but now my requirement is changed ,suppose the source folder where all the zipped files are present is refreshed or updated with new zipped files regularly then how can I implement in my code multithreading to get several files by threads and send it for unzipping.
    Please suggest with some example or edit my code.
    package com.myprojcet;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipInputStream;
    public class Main {
         * Extracts a zip file
         public void extractZipFile() {
              try {
                   String zipFileName = "C:\\soft\\test"; //Source folder for zipped files
                   //Create input and output streams
                   File SourceDir = new File(zipFileName);
                   File[] zipFiles = SourceDir.listFiles();
                   ZipInputStream inStream = null;
                   OutputStream outStream = null;
                   ZipEntry entry;
                   byte[] buffer = new byte[1024];
                   int nrBytesRead;
                   //Get next zip entry and start reading data
              for(int i=0; i < zipFiles.length; i++) {
                   inStream= new ZipInputStream(new FileInputStream(zipFiles));
                   while((entry = inStream.getNextEntry()) != null) {
                        outStream=new FileOutputStream("C:\\soft\\test2\\"+entry.toString()); //destination folder for unzipped file
                        while ((nrBytesRead = inStream.read(buffer)) > 0) {     
                             outStream.write(buffer, 0, nrBytesRead);
                   //Finish off by closing the streams
                   outStream.close();
                   inStream.close();
              } catch (IOException ex) {
                   ex.printStackTrace();
         * @param args the command line arguments
         public static void main(String[] args) {
              new Main().extractZipFile();
    Thanks
    Sumit
    Edited by: user8687839 on Feb 27, 2012 11:00 PM

    But my question is that if in a source folder we have several files which are in zipped format and the folder is getting updated every min (say) with new zipped files (which are dumped from some outside environment).I need to unzip all the files present in the folder ,if new one comes there then also check for the new zipped file and unzip it.You don't need to keep re-stating that.
    I had written a code for unzipping a file from a folder (thinking the folder is not updated everytime).Or that.
    Now I am thinking of using threads because if I create suppose 5 threads and every threads poll the source folder and pick up a zip file ,send it for unzipping it and again poll the source folder for any new entries?Or that.
    If using the threads here hits performace then what should I use?Err, what you presently have?
    Provide me any sample code or link that would be more useful.You've already written it.

  • Unzip files from FTP using  ABAP

    Hi All,
    I have the a requirement to unzip certain files from ftp and transfer the extracted files to another directory in ftp.
    Searched  (Re: Unzip file;)  in SDN but didnt find the perfect solution
    Appreciate the help.
    Regards
    Siva

    You can use IndexOf function
    see this example
    http://visakhm.blogspot.in/2012/05/package-to-implement-daily-processing.html
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

Maybe you are looking for

  • Please Help:  A Problem With Oracle-Provided 'Working' Example

    A Problem With Oracle-Provided 'Working' Example Using htp.formcheckbox I followed the simple steps in the Oracle-provided example: Doc ID: Note:116534.1 Subject: How to use checkbox in webdb for bulk update using webdb report However, when I select

  • Time Gap in Message Processing in SAP PI

    Dear All, We are having soap to Proxy Synchronous ,in this Scnerio non SAP System call SAP PI Soap Service and send data to PI for Processing in ECC. We are facing a issue like suppose non sap system sends data to SAP PI Around 11 Am then when we che

  • API to close purchase documents and to update blanket agreement amount

    Hi, Are there any API's to close the standard purchase order and blanket agreements. Also do we have any API to update the blanket agreement amount. Regards, Amitesh

  • Showing User ID in Error Message

    Fellow Developers, I am trying to Include the User ID in an error message. I want the message to say "Payment Advice in use by XXXXXXX".  In SE91 if I enter a "&" it spits out the company code and says "Payment Advice in use by Z200" (The company cod

  • What's the best way to transfer an old 15" MacBook Pro to a new MacBook?

    Hello. My client will be buying a new MacBook soon (don't know which model yet) from his university. We are currently researching and planning ahead to minimize problems and prepare. I noticed there are multiple ways to transfer data from his old 15"