Forum Discussion

PrecisionDan's avatar
Occasional Contributor
2 years ago

Is it possible to unzip a compressed folder through a TestComplete script (c#Script)



I've got a .zip stored locally that I'm hoping I can unzip and open using testcomplete. I have had an explore around the aqFileSystem and aqFile objects but haven't been able to work anything out in my scripts. I did stumble upon a forum post from 2011 ( but the method they are indicating to use seems to not work anymore.


Any guidance I can get to take the .zip and unzip it so I can interact with the contents inside would be amazing.


Kind regards,


2 Replies

  • rraghvani's avatar
    Champion Level 3

    Yes. You can use the following code - provide the appropriate command and parameters of the application, and pass it into Exec method.



    function Test()
        var oExec = WshShell.Exec("zip command goes here"); 
        while (oExec.Status == 0) {
        while (!oExec.StdOut.AtEndOfStream) {



    For example,


    // Decompressing files without asking for confirmation to replace
    "D7Zip.exe -u ""c:\"" -f ""c:\folderout\"" -r"
    // Extracts all *.gif files
    "unrar x c:\yourfile.rar *.gif c:\extractfolder\"


  • PrecisionDan's avatar
    Occasional Contributor

    Thank you for the help here. I also found another solution to this in one of the comments here: 

    Basically, I needed to replace 

    var fso = new ActiveXObject("Scripting.FileSystemObject");


    var objShell = new ActiveXObject("Shell.Application");



    var fso = Sys.OleObject("Scripting.FileSystemObject")




    var objShell = Sys.OleObject("Shell.Application");