7zip in powershell script

Multi tool use
Multi tool use












0















I need to unzip several .zip archives using a powershell script.
In the past, I used



Expand-Archive foo.zip -DestinationPath $dest


and it worked. But it takes a while to complete. As 7zip is faster, I added it to the windows path.



I just did 7z.exe x archive.zip and it worked.
It also work on CMD if I enter it as a single command from terminal.



When I add this command in the script and run the .ps1 script, it give me:




7z.exe : Le terme « 7z.exe » n'est pas reconnu comme nom d'applet de
commande, fonction, fichier de script ou programme exécutable





Translation:




(7z.exe: The Term "7z.exe" Is Not Recognized as Cmdlet Name, Function, Script File, or Executable Program)











share|improve this question

























  • Why not just giving the full-path to 7zip? Instead of doing 7z you just do "C:Program Files7-Zip7z.exe" x archive.zip?

    – maio290
    Jan 3 at 9:15













  • @maio290 Just tryed and : Jeton inattendu « x » dans l’expression ou l’instruction. (Unexpected token "x" in the expression or statement.)

    – xHypnosia
    Jan 3 at 9:18






  • 1





    Ah, yeah, sorry, in powershell it's &'C:Program Files7-Zip7z.exe' x archive.zip

    – maio290
    Jan 3 at 9:20






  • 2





    The suggestion with the full path is probably missing the call operator: &, that is & "c:Program Files..." ..., see ss64.com/ps/call.html.

    – Micha Wiedenmann
    Jan 3 at 9:20











  • Worked. Thanks.

    – xHypnosia
    Jan 3 at 9:23
















0















I need to unzip several .zip archives using a powershell script.
In the past, I used



Expand-Archive foo.zip -DestinationPath $dest


and it worked. But it takes a while to complete. As 7zip is faster, I added it to the windows path.



I just did 7z.exe x archive.zip and it worked.
It also work on CMD if I enter it as a single command from terminal.



When I add this command in the script and run the .ps1 script, it give me:




7z.exe : Le terme « 7z.exe » n'est pas reconnu comme nom d'applet de
commande, fonction, fichier de script ou programme exécutable





Translation:




(7z.exe: The Term "7z.exe" Is Not Recognized as Cmdlet Name, Function, Script File, or Executable Program)











share|improve this question

























  • Why not just giving the full-path to 7zip? Instead of doing 7z you just do "C:Program Files7-Zip7z.exe" x archive.zip?

    – maio290
    Jan 3 at 9:15













  • @maio290 Just tryed and : Jeton inattendu « x » dans l’expression ou l’instruction. (Unexpected token "x" in the expression or statement.)

    – xHypnosia
    Jan 3 at 9:18






  • 1





    Ah, yeah, sorry, in powershell it's &'C:Program Files7-Zip7z.exe' x archive.zip

    – maio290
    Jan 3 at 9:20






  • 2





    The suggestion with the full path is probably missing the call operator: &, that is & "c:Program Files..." ..., see ss64.com/ps/call.html.

    – Micha Wiedenmann
    Jan 3 at 9:20











  • Worked. Thanks.

    – xHypnosia
    Jan 3 at 9:23














0












0








0








I need to unzip several .zip archives using a powershell script.
In the past, I used



Expand-Archive foo.zip -DestinationPath $dest


and it worked. But it takes a while to complete. As 7zip is faster, I added it to the windows path.



I just did 7z.exe x archive.zip and it worked.
It also work on CMD if I enter it as a single command from terminal.



When I add this command in the script and run the .ps1 script, it give me:




7z.exe : Le terme « 7z.exe » n'est pas reconnu comme nom d'applet de
commande, fonction, fichier de script ou programme exécutable





Translation:




(7z.exe: The Term "7z.exe" Is Not Recognized as Cmdlet Name, Function, Script File, or Executable Program)











share|improve this question
















I need to unzip several .zip archives using a powershell script.
In the past, I used



Expand-Archive foo.zip -DestinationPath $dest


and it worked. But it takes a while to complete. As 7zip is faster, I added it to the windows path.



I just did 7z.exe x archive.zip and it worked.
It also work on CMD if I enter it as a single command from terminal.



When I add this command in the script and run the .ps1 script, it give me:




7z.exe : Le terme « 7z.exe » n'est pas reconnu comme nom d'applet de
commande, fonction, fichier de script ou programme exécutable





Translation:




(7z.exe: The Term "7z.exe" Is Not Recognized as Cmdlet Name, Function, Script File, or Executable Program)








powershell 7zip






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 3 at 20:04









Ansgar Wiechers

145k13132190




145k13132190










asked Jan 3 at 9:11









xHypnosiaxHypnosia

196




196













  • Why not just giving the full-path to 7zip? Instead of doing 7z you just do "C:Program Files7-Zip7z.exe" x archive.zip?

    – maio290
    Jan 3 at 9:15













  • @maio290 Just tryed and : Jeton inattendu « x » dans l’expression ou l’instruction. (Unexpected token "x" in the expression or statement.)

    – xHypnosia
    Jan 3 at 9:18






  • 1





    Ah, yeah, sorry, in powershell it's &'C:Program Files7-Zip7z.exe' x archive.zip

    – maio290
    Jan 3 at 9:20






  • 2





    The suggestion with the full path is probably missing the call operator: &, that is & "c:Program Files..." ..., see ss64.com/ps/call.html.

    – Micha Wiedenmann
    Jan 3 at 9:20











  • Worked. Thanks.

    – xHypnosia
    Jan 3 at 9:23



















  • Why not just giving the full-path to 7zip? Instead of doing 7z you just do "C:Program Files7-Zip7z.exe" x archive.zip?

    – maio290
    Jan 3 at 9:15













  • @maio290 Just tryed and : Jeton inattendu « x » dans l’expression ou l’instruction. (Unexpected token "x" in the expression or statement.)

    – xHypnosia
    Jan 3 at 9:18






  • 1





    Ah, yeah, sorry, in powershell it's &'C:Program Files7-Zip7z.exe' x archive.zip

    – maio290
    Jan 3 at 9:20






  • 2





    The suggestion with the full path is probably missing the call operator: &, that is & "c:Program Files..." ..., see ss64.com/ps/call.html.

    – Micha Wiedenmann
    Jan 3 at 9:20











  • Worked. Thanks.

    – xHypnosia
    Jan 3 at 9:23

















Why not just giving the full-path to 7zip? Instead of doing 7z you just do "C:Program Files7-Zip7z.exe" x archive.zip?

– maio290
Jan 3 at 9:15







Why not just giving the full-path to 7zip? Instead of doing 7z you just do "C:Program Files7-Zip7z.exe" x archive.zip?

– maio290
Jan 3 at 9:15















@maio290 Just tryed and : Jeton inattendu « x » dans l’expression ou l’instruction. (Unexpected token "x" in the expression or statement.)

– xHypnosia
Jan 3 at 9:18





@maio290 Just tryed and : Jeton inattendu « x » dans l’expression ou l’instruction. (Unexpected token "x" in the expression or statement.)

– xHypnosia
Jan 3 at 9:18




1




1





Ah, yeah, sorry, in powershell it's &'C:Program Files7-Zip7z.exe' x archive.zip

– maio290
Jan 3 at 9:20





Ah, yeah, sorry, in powershell it's &'C:Program Files7-Zip7z.exe' x archive.zip

– maio290
Jan 3 at 9:20




2




2





The suggestion with the full path is probably missing the call operator: &, that is & "c:Program Files..." ..., see ss64.com/ps/call.html.

– Micha Wiedenmann
Jan 3 at 9:20





The suggestion with the full path is probably missing the call operator: &, that is & "c:Program Files..." ..., see ss64.com/ps/call.html.

– Micha Wiedenmann
Jan 3 at 9:20













Worked. Thanks.

– xHypnosia
Jan 3 at 9:23





Worked. Thanks.

– xHypnosia
Jan 3 at 9:23












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54019222%2f7zip-in-powershell-script%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54019222%2f7zip-in-powershell-script%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







AcL7R0 6h HwK,01Pqm KCWxL38Zm62,L95 jhvBI2MSm5nNLu73sqqZXDCWB4F4V oZQVj2cIRB6C7vuxNHiRKMZK
BU34PnDYKnd lzxC,lU,OGVG x7MlLMDlO0o0Mg,bW3IqTu1yiVzPkzbh8gxLFWEmIo2JXdm E3bL7UY9BCautxm9yvG

Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas