Command line parameters

4 views
Skip to first unread message

Copper Hill

unread,
Jul 20, 2009, 2:56:33 AM7/20/09
to worldhunter
Command line parameters

http://www.robvanderwoude.com/parameters.php

Windows NT 4 introduced a set of new features for command line
parameters:

%*
will return all command line parameters following %0; keep in mind
that Windows NT 4 will insert an extra space before %*, whereas 2000
and XP will remove all leading spaces from %*;
%~dn
will return the drive letter of %n (n can range from 0 to 9) if %n
is a valid path or file name (no UNC);
%~pn
will return the directory of %n if %n is a valid path or file name
(no UNC);
%~nn
will return the file name only of %n if %n is a valid file name;
%~xn
will return the file extension only of %n if %n is a valid file
name;
%~fn
will return the fully qualified path of %n if %n is a valid file
name or directory;

Windows 2000 and XP add even more options.
More information can be found at the page explaining NT's CALL
command.

To remove the leading space of %* introduced by NT 4 use the following
commands:

SET commandline=%*
IF NOT CMDEXTVERSION 2 SET commandline=%commandline:~1%
Reply all
Reply to author
Forward
0 new messages