File Compression Using a .bat
OliG
Posted messages
4
Status
Membre
-
BlueskyFR Posted messages 76 Status Membre -
BlueskyFR Posted messages 76 Status Membre -
Hello,
I am looking for an example of a batch file that creates a .zip from a .bat. This must be executed automatically after a C++ compilation in Visual Studio 2005, so it is not possible to manually compress the files. I need to include files that are in different directories into a single .zip.
Does Windows have a default "zip" command? I need to send this project via email, and I need to be sure that the .bat will work on the recipient's machine... so I can't use some obscure program, no matter how effective it is. What are my options?
So far, I have tried the "zip" command but I get an error: 'zip' is not recognized as an internal or external command, an executable program or a batch file.
Any help would be appreciated,
Thank you!
I am looking for an example of a batch file that creates a .zip from a .bat. This must be executed automatically after a C++ compilation in Visual Studio 2005, so it is not possible to manually compress the files. I need to include files that are in different directories into a single .zip.
Does Windows have a default "zip" command? I need to send this project via email, and I need to be sure that the .bat will work on the recipient's machine... so I can't use some obscure program, no matter how effective it is. What are my options?
So far, I have tried the "zip" command but I get an error: 'zip' is not recognized as an internal or external command, an executable program or a batch file.
Any help would be appreciated,
Thank you!
Configuration: Windows Vista Firefox
19 réponses
hello
I'm using the free 7-zip: https://www.7-zip.org/
in the help section, there are all the options to run it from the command line, so in .bat:
I'm using the free 7-zip: https://www.7-zip.org/
in the help section, there are all the options to run it from the command line, so in .bat:
Commands quick reference Command Description a Add d Delete e Extract l List t Test u Update x eXtract with full paths
Wow! I didn't expect that!
I know very well that Winzip is commercial... I don't use Winzip, that's all...
By the way, where does this brutal remark about Winzip come from? From the command "zip"? I mentioned this since a friend, wanting to help me, gave me a short example that included this command... The trouble is that I can't use it at home (maybe precisely because I don't have Winzip?), the compiler returns an error (as mentioned above): "zip" is not recognized as an internal or external command, an executable program, or a batch file. My question remains: is there a default command that allows zipping files on any computer?
Please be lenient if there are any oddities in my question, the truth is that I've never done a batch file... I've searched the internet but I haven't found anything conclusive on compression batch files (except for pkzip, but I can't use that). That's precisely why I'm asking for your help on this matter.
If you think about making a personal attack against me without bringing anything constructive to my problem... please kindly leave without causing a ruckus (like you, Phil)
If you can help me or simply direct me to a website that I've missed, I would greatly appreciate it.
Thank you.
I know very well that Winzip is commercial... I don't use Winzip, that's all...
By the way, where does this brutal remark about Winzip come from? From the command "zip"? I mentioned this since a friend, wanting to help me, gave me a short example that included this command... The trouble is that I can't use it at home (maybe precisely because I don't have Winzip?), the compiler returns an error (as mentioned above): "zip" is not recognized as an internal or external command, an executable program, or a batch file. My question remains: is there a default command that allows zipping files on any computer?
Please be lenient if there are any oddities in my question, the truth is that I've never done a batch file... I've searched the internet but I haven't found anything conclusive on compression batch files (except for pkzip, but I can't use that). That's precisely why I'm asking for your help on this matter.
If you think about making a personal attack against me without bringing anything constructive to my problem... please kindly leave without causing a ruckus (like you, Phil)
If you can help me or simply direct me to a website that I've missed, I would greatly appreciate it.
Thank you.
I don't see what's so terrible about my question, can someone explain it to me?
If no compression program is installed, Windows supports decompressing files... Is it so dumb to ask if there is a console command for this operation?
I ended up including 7za.exe in my folder (a "stand alone" version of 7z)...
If no compression program is installed, Windows supports decompressing files... Is it so dumb to ask if there is a console command for this operation?
I ended up including 7za.exe in my folder (a "stand alone" version of 7z)...
Thank you, dubcek!
I tried using 7-zip and it works very well.
The only grain of sand in the gears is that if the recipient of my project doesn't have the 7-zip program on their computer, they won't be able to compile. That's why I wanted to know if there is a default Windows command for compression.
In truth, by "obscure program," I was referring to info-zip, a free compression utility that works as well but doesn't seem very well known. For now, I will simply indicate or download 7-zip.
Out of personal curiosity, for next time, does anyone know if there is a Windows-specific compression command?
Thanks again, dubcek!
I tried using 7-zip and it works very well.
The only grain of sand in the gears is that if the recipient of my project doesn't have the 7-zip program on their computer, they won't be able to compile. That's why I wanted to know if there is a default Windows command for compression.
In truth, by "obscure program," I was referring to info-zip, a free compression utility that works as well but doesn't seem very well known. For now, I will simply indicate or download 7-zip.
Out of personal curiosity, for next time, does anyone know if there is a Windows-specific compression command?
Thanks again, dubcek!
If I understand the question correctly, the goal is to have an open-source C++ program that creates or reads a .zip file?
Hello,
I need your help, hoping not to be insulted because my question will be "stupid."
7Zip is installed on my PC, but when I type 7z at the command prompt, it responds: "'7Z' is not recognized as an internal or external command..."
Where is my mistake? I saw this command in the Help file of 7 Zip, isn't that how it is used?
Thank you in advance.
I need your help, hoping not to be insulted because my question will be "stupid."
7Zip is installed on my PC, but when I type 7z at the command prompt, it responds: "'7Z' is not recognized as an internal or external command..."
Where is my mistake? I saw this command in the Help file of 7 Zip, isn't that how it is used?
Thank you in advance.
You must specify the full path, with quotes due to spaces
C:>"C:\Program Files\7-Zip\7z"
7-Zip 4.42 Copyright (c) 1999-2006 Igor Pavlov 2006-05-14
Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
[<@listfiles...>]
<Commands>
a: Add files to archive
d: Delete files from archive
...
...
C:>"C:\Program Files\7-Zip\7z"
7-Zip 4.42 Copyright (c) 1999-2006 Igor Pavlov 2006-05-14
Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
[<@listfiles...>]
<Commands>
a: Add files to archive
d: Delete files from archive
...
...
les " sont inutiles s'il n'y a pas d'espace dans les noms
l'erreur est dans le fichier F:\Mesdocs
List file
You can supply one or more filenames or wildcards for special list files (files containing lists of files). The filenames in such list file must be separated by new line symbol(s).
For list files, 7-Zip uses UTF-8 encoding by default. You can change encoding using -scs switch.
Multiple list files are supported.
For example, if the contents of file "listfile.txt" are the following:
My programs\*.cpp
Src\*.cpp
then command
7z a -tzip archive.zip @listfile.txt
adds to archive "archive.zip" all "*.cpp" files from directories "My programs" and "Src".
l'erreur est dans le fichier F:\Mesdocs
List file
You can supply one or more filenames or wildcards for special list files (files containing lists of files). The filenames in such list file must be separated by new line symbol(s).
For list files, 7-Zip uses UTF-8 encoding by default. You can change encoding using -scs switch.
Multiple list files are supported.
For example, if the contents of file "listfile.txt" are the following:
My programs\*.cpp
Src\*.cpp
then command
7z a -tzip archive.zip @listfile.txt
adds to archive "archive.zip" all "*.cpp" files from directories "My programs" and "Src".
If I want to compress the entire folder F:\Mesdocs, do I still need to go through a listfile.txt in which I would write only F:\Mesdocs?
So what's the problem when I want to compress F:\Mesdocs, the path name isn't detailed enough?
Thank you for your help.
Thank you for your help.