Now I list according to your requirement. I have a MyFolder created on my desktop that contains 5 files, for example below, as you indicated
MyFolder --subFolder1 --subFolder2 --file1.txt --file2.doc --file3.js
Now you request zip all the contents in MyFolder, then the first step is to go to this path to the folder that is on the desktop, so first I search on my desktop.
Note: (My username will be different from you, you hope you know the basic Windows materials)
1.C:\Documents and Settings\ishwar\Desktop\MyFolder>set path="c:\ProgramFiles \WinRAR";%path% -- Set the path (note if you are doing using commands from cmd prompt you need to do this every time when you open cmd newly if you are creating batch file then OK) 2. C:\Documents and Settings\ishwar>cd Desktop 3. C:\Documents and Settings\ishwar\Desktop>cd MyFolder -- change directory to the folder in which all the files are stored. 4. C:\Documents and Settings\ishwar\Desktop\MyFolder>winrar a MyFolder *.* -- this command will zip all the contents and will create MyFolder.rar file within MyFolder. 5. You are done.
Where
winrar - zip command
a is an argument
MyFolder to specify a name in zip.
*.* means zip of all files

source share