|This article contains basic information to help with the use of the WinZip Command Line Support Add-on. It is intended for users who are not experienced with command line use. For specific help with the add-on, please see the information in WinZip Command Line Add-on Help located in the WinZip program group.|
A command line switch (also known as an option, a parameter, or a flag) acts as a modifier to the command you are issuing in the Command Prompt window, in a batch file, or in other scripts. Usually, a switch is a single letter preceded by a forward slash. For an example, we will look at the DIR command and its switches.
The DIR command is used to display a listing of files and folders in the current folder. For example, if you open a Command Prompt window, use "CD \" to move to the Documents folder, type DIR, and press Enter, you may see something similar to the picture below.
The items are listed alphabetically by name (far right column), regardless of whether they are files or directories. Each line contains the item's timestamp, <DIR> in the next column (if the item is a directory), the size in bytes (if the item is a file), and then the name. Totals are displayed at the bottom and there is some introductory information at the beginning (not displayed in the picture).
If you now display the help text for this command by typing DIR /? you will see a brief sentence describing what DIR does followed by the syntax for the command with brief descriptions for each option. The syntax for DIR should look like this:
DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N] [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]
Each option for the DIR command is in brackets. As already demonstrated, you can use DIR all by itself. However, you may want to display this list in a particular format, in a particular order, and/or you may want to display only particular information. You can even display a listing from another directory.
For example, if you wanted to:
- List the contents of the Name subdirectory in the Users directory
- See the contents of subdirectories below the Logon directory
- Display only the names of the items
- Display the names sorted in reverse alphabetic order
you could type: DIR Users\Name /s /b /o:-n and then press Enter. The output of your command would begin with the subfolder that is last alphabetically (possibly the Video subfolder) listing the path to this folder first (C:\Users\Logon\Video) and then paths to each file. The output should then work backwards through the alphabet ending with the subfolder that is first alphabetically.
By experimenting with the various switches, you may find a result that would be particularly useful. You may want to record the result of the command you run in a log file, which you can do by redirecting the display output.
This is the last article in the Command Line Basics section. If you would like more information you may want to do an internet search for command line, command prompt, DOS commands, batch files, or some other topic of interest. You may also want to review the information in the Related Articles listed below. If you have any questions regarding this information as it relates to the WinZip Command Line Support Add-On, please submit a Technical Support ticket.
Command Line Basics articles
Methods to try fixing invalid Zip files with the command line add-on
How to create a log file when using WinZip Command Line Support Add-on
Create individual Zip files with a command line
How to include the current date in the filename - WinZip Command Line Support Add-on