• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Argument Editing

CMD lets you modify arguments as they're replaced on the command line. Most of the modifications assume that the argument is a filename and let you extract or fill in various parts of the name. When command extensions are enabled, CMD can insert edited versions of the arguments by placing a tilde (~) and some additional characters after the % sign. The editing functions let you manipulate filenames passed as arguments. Table 12.2 lists the edit options, using argument number 1 as an example.

Table 12.2. Argument Editing Expressions
Expression Result
%~1 Removes surrounding quotes (").
%~f1 Fully qualified pathname.
%~d1 Drive letter only.
%~p1 Path only.
%~n1 Filename only.
%~x1 File extension only.
%~s1 Short DOS 8.3 file and path.
%~a1 File attributes.
%~t1 Modification date/time of file.
%~z1 Length of file in bytes.
%~$PATH:1 Fully qualified name of the first matching file when searching PATH. If no file is found, the result is a zero-length string. The filename must include the proper extension; PATHEXT is not used.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint