What is the equivalent to --help or man page in Windows?
If I want to know what my options are for a Linux program then I'll do man program
or program --help
to find out. How do you do that on Windows?
I was reading about how to run a screensaver from the command line and I found out about this file:
%SYSTEMROOT%\system32\scrnsave.scr
When called directly, the settings page for that screensaver is launched instead of the actual screensaver.
I tried help scrnsave.scr
and scrnsave.scr /?
and more, but nothing worked. It wasn't until I tried google that I found the command line options in the middle of a MSDN article and knew I had to use:
%SYSTEMROOT%\system32\scrnsave.scr /s
How was I supposed to know about the /s option? What is the correct way to find program options in the Windows command line?
There isn't a correct way. But there isn't on Unix, either. The --help
convention is in fact a GNU convention. It's widespread on Linux distributions, where the operating system utilities are GNU ones. But you won't see it in the operating system utilities on a BSD, for example:
$ /bin/sh --help
Illegal option --
$ nawk --help
nawk: no program given
$
Much as the --help
convention has been seen by many as a good idea, and adopted; the /?
convention (which originated in DR-DOS 5.0 as a /H
convention) has been seen by many as a good idea, and adopted. You'll find that many commands support it. But equally as not all commands in Unix or Linux support --help
not all commands in DOS or Windows NT support /?
.
You might think that man
comes to the rescue here. Thanks to GNU info
, and the fact that several program maintainers seem to place information (even sometimes information as basic as what the command-line options are) only in the info
page and not in the man
page or vice versa, it's not the panacaea that it might be thought to be, however.
man
doesn't really have an equivalent in the DOS and Windows NT world. The closest equivalent was help
command, which in DR-DOS 5.0 and later and MS-DOS 6.0 and later would look up command in a database of help pages and display the page. The problem here is that whilst all of the operating system's own housekeeping utilities had pages in this database, almost no-one else's programs did, and the system was hard to add third-party information to.
(DOSBook, introduced in DR-DOS 6.0 was about the best that any commercial DOS got with this. MS-DOS used QuickHelp files, the tool for compiling which wasn't supplied with the base operating system. PC-DOS 7 had the IPF system, a tool for compiling which again was lacking from the operating system. OS/2 had the same IPF system as PC-DOS, and a HELP command that was integrated with it, although again the compiler, IPFC, was in the Developers Toolkit rather than in the box with the operating system. Many years ago I wrote an improvement upon the supplied HELP command where one could configure which command references it looked commands up in by default, with an environment variable. I also provided an extended command reference book for some commands that I'd written.)
Windows NT still has help
command to this day. It's a step backwards from what MS-DOS 6 had, let alone from what DR-DOS, PC-DOS, and OS/2 had.
So the actual answer is: You're supposed to trawl through MSDN, or read someone else's WWW site, or read a book, or read the source code (if it's open source), or just know telepathically …
That said, documentation on the WWW is not a bad thing, and is largely the expectation nowadays. (Although one can miss things like IPFC building indexes and tables of contents for one. ☺) Microsoft documents a whole raft of command-line commands on TechNet and in MSDN, as you have seen.
Further reading
- 4.7 Standards for Command Line Interfaces. GNU Coding Standards. Free Software Foundation.
- Customizing DOSBook. Caldera.
- Jonathan de Boyne Pollard. HELPMSG. 32-bit Command Interpreter command reference.
- HELP. TCC/LE command reference. JP Software.
- IPF Programming Guide and Reference. OS/2 Warp 4.5 Developers' Toolkit. IBM.
- Windows XP Command line reference A–Z. TechNet. Microsoft corporation.
For pure Windows programs, displaying help is usually /?
. However, there are more and more cross-platform programs coming up and they use -?
, --help
or even other commands.
Actually it's not required by Windows programs to support any help output at all, so it's all up to the developer of the program.
Screensavers are a little bit special, because Microsoft has defined what a screensaver has to support. And what you found it exactly that definition Obviously Microsoft does not define any mandatory /?
command line switch.