How to unzip a ZIP archive file using batch file? [duplicate]









up vote
2
down vote

favorite













This question already has an answer here:



  • How can I compress (/ zip ) and uncompress (/ unzip ) files and folders with batch file without using any external tools?

    3 answers



I would like to use a .bat file to unzip a ZIP compressed archive file if possible at all. Nothing fancy, I just want to extract the entire archive file to the same location, i.e. download a .zip file to desktop and want to extract it next to desktop with the same name.



I tried this, but with no success.



for /R "C:UsersDesktoptest.zip" %%I in ("*.zip") do(
"%ProgramFiles(x86)%7-zip7z.exe" x - y -o"%%~dpnI" "%%~fI"
)
exit









share|improve this question















marked as duplicate by Mofi batch-file
Users with the  batch-file badge can single-handedly close batch-file questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 11 at 11:16


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • Break it into smaller chunks. Try getting the unzip working on a single file.
    – Squashman
    Nov 11 at 3:47










  • Do you want to unzip one archive or many?
    – jwdonahue
    Nov 11 at 4:59














up vote
2
down vote

favorite













This question already has an answer here:



  • How can I compress (/ zip ) and uncompress (/ unzip ) files and folders with batch file without using any external tools?

    3 answers



I would like to use a .bat file to unzip a ZIP compressed archive file if possible at all. Nothing fancy, I just want to extract the entire archive file to the same location, i.e. download a .zip file to desktop and want to extract it next to desktop with the same name.



I tried this, but with no success.



for /R "C:UsersDesktoptest.zip" %%I in ("*.zip") do(
"%ProgramFiles(x86)%7-zip7z.exe" x - y -o"%%~dpnI" "%%~fI"
)
exit









share|improve this question















marked as duplicate by Mofi batch-file
Users with the  batch-file badge can single-handedly close batch-file questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 11 at 11:16


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • Break it into smaller chunks. Try getting the unzip working on a single file.
    – Squashman
    Nov 11 at 3:47










  • Do you want to unzip one archive or many?
    – jwdonahue
    Nov 11 at 4:59












up vote
2
down vote

favorite









up vote
2
down vote

favorite












This question already has an answer here:



  • How can I compress (/ zip ) and uncompress (/ unzip ) files and folders with batch file without using any external tools?

    3 answers



I would like to use a .bat file to unzip a ZIP compressed archive file if possible at all. Nothing fancy, I just want to extract the entire archive file to the same location, i.e. download a .zip file to desktop and want to extract it next to desktop with the same name.



I tried this, but with no success.



for /R "C:UsersDesktoptest.zip" %%I in ("*.zip") do(
"%ProgramFiles(x86)%7-zip7z.exe" x - y -o"%%~dpnI" "%%~fI"
)
exit









share|improve this question
















This question already has an answer here:



  • How can I compress (/ zip ) and uncompress (/ unzip ) files and folders with batch file without using any external tools?

    3 answers



I would like to use a .bat file to unzip a ZIP compressed archive file if possible at all. Nothing fancy, I just want to extract the entire archive file to the same location, i.e. download a .zip file to desktop and want to extract it next to desktop with the same name.



I tried this, but with no success.



for /R "C:UsersDesktoptest.zip" %%I in ("*.zip") do(
"%ProgramFiles(x86)%7-zip7z.exe" x - y -o"%%~dpnI" "%%~fI"
)
exit




This question already has an answer here:



  • How can I compress (/ zip ) and uncompress (/ unzip ) files and folders with batch file without using any external tools?

    3 answers







batch-file unzip






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 11:15









Mofi

27.4k83776




27.4k83776










asked Nov 11 at 1:48









adamrowe16495

111




111




marked as duplicate by Mofi batch-file
Users with the  batch-file badge can single-handedly close batch-file questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 11 at 11:16


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by Mofi batch-file
Users with the  batch-file badge can single-handedly close batch-file questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 11 at 11:16


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • Break it into smaller chunks. Try getting the unzip working on a single file.
    – Squashman
    Nov 11 at 3:47










  • Do you want to unzip one archive or many?
    – jwdonahue
    Nov 11 at 4:59
















  • Break it into smaller chunks. Try getting the unzip working on a single file.
    – Squashman
    Nov 11 at 3:47










  • Do you want to unzip one archive or many?
    – jwdonahue
    Nov 11 at 4:59















Break it into smaller chunks. Try getting the unzip working on a single file.
– Squashman
Nov 11 at 3:47




Break it into smaller chunks. Try getting the unzip working on a single file.
– Squashman
Nov 11 at 3:47












Do you want to unzip one archive or many?
– jwdonahue
Nov 11 at 4:59




Do you want to unzip one archive or many?
– jwdonahue
Nov 11 at 4:59












1 Answer
1






active

oldest

votes

















up vote
0
down vote













You shouldn't need the loop. Depending on whether you want to extract the directory structure contained within the archive or just extract everything to a single directory, you would use:



7z e C:UsersDesktoptest.zip -o C:UsersDesktoptest


or



7z x C:UsersDesktoptest.zip -o C:UsersDesktoptest


See https://sevenzip.osdn.jp/chm/cmdline/commands/index.htm for a list of commands and drill down as needed for the various options.



You should not need a for loop in your batch file, unless you intend to only extract files based on a list of patterns.






share|improve this answer



























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    You shouldn't need the loop. Depending on whether you want to extract the directory structure contained within the archive or just extract everything to a single directory, you would use:



    7z e C:UsersDesktoptest.zip -o C:UsersDesktoptest


    or



    7z x C:UsersDesktoptest.zip -o C:UsersDesktoptest


    See https://sevenzip.osdn.jp/chm/cmdline/commands/index.htm for a list of commands and drill down as needed for the various options.



    You should not need a for loop in your batch file, unless you intend to only extract files based on a list of patterns.






    share|improve this answer
























      up vote
      0
      down vote













      You shouldn't need the loop. Depending on whether you want to extract the directory structure contained within the archive or just extract everything to a single directory, you would use:



      7z e C:UsersDesktoptest.zip -o C:UsersDesktoptest


      or



      7z x C:UsersDesktoptest.zip -o C:UsersDesktoptest


      See https://sevenzip.osdn.jp/chm/cmdline/commands/index.htm for a list of commands and drill down as needed for the various options.



      You should not need a for loop in your batch file, unless you intend to only extract files based on a list of patterns.






      share|improve this answer






















        up vote
        0
        down vote










        up vote
        0
        down vote









        You shouldn't need the loop. Depending on whether you want to extract the directory structure contained within the archive or just extract everything to a single directory, you would use:



        7z e C:UsersDesktoptest.zip -o C:UsersDesktoptest


        or



        7z x C:UsersDesktoptest.zip -o C:UsersDesktoptest


        See https://sevenzip.osdn.jp/chm/cmdline/commands/index.htm for a list of commands and drill down as needed for the various options.



        You should not need a for loop in your batch file, unless you intend to only extract files based on a list of patterns.






        share|improve this answer












        You shouldn't need the loop. Depending on whether you want to extract the directory structure contained within the archive or just extract everything to a single directory, you would use:



        7z e C:UsersDesktoptest.zip -o C:UsersDesktoptest


        or



        7z x C:UsersDesktoptest.zip -o C:UsersDesktoptest


        See https://sevenzip.osdn.jp/chm/cmdline/commands/index.htm for a list of commands and drill down as needed for the various options.



        You should not need a for loop in your batch file, unless you intend to only extract files based on a list of patterns.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 11 at 5:05









        jwdonahue

        2,5802824




        2,5802824













            Popular posts from this blog

            Use pre created SQLite database for Android project in kotlin

            Darth Vader #20

            Ondo