You can setup DOSKEY Macros to speed up your command line activity even more. Macros save typing, and allow you to combine multiple commands into one. They are a light weight alternative to batch files, and they perform faster.
To use macros:
Click here for extensive Microsoft macro documentation and examples.
Example: Create a DOSKEY macro named ue that syncs a file, open it for edit in Perforce, and then opens it in a favorite editor:
doskey ue=p4 sync $* $T p4 edit $* $T "D:\Program Files\UltraEdit\uedit32.exe" $*
The
Create a series of such macros, and put them in a file. Store your macros anwyere you like; they usually go in a file named doskey.mac. If you would like to put your macros in version control, create a folder under //depot/admin/users/youruserid in Perforce. For example, you might create your doskey.mac file as:
D:\p4\Projects.userid\depot\admin\users\userid\doskey.mac
Then just add it to Perforce and change it like any other versioned file.
Then create a shortcut (or modify the existing shortcut in the Start Menu) so it looks something like this:
%windir%\System32\CMD.exe /F:ON /K DOSKEY /macrofile="D:\p4\Projects.userid\depot\admin\users\userid\doskey.mac"Note: The
If you don't want to put your macros in version control, you might use the %USERPROFILE% variable to put them in your home directory:
%windir%\System32\CMD.exe /F:ON /K DOSKEY /macrofile="%USERPROFILE%\doskey.mac"
Advanced Topic: If you need your macros to be portable across machines (e.g. your desktop and laptop), you can define a system variable, say UDIR, and set it contain the path on your local machine where your doeskey.mac file lives. Then, use (or define if necessary) variables that show where programs used in macros (such as your favorite editors) are installed.
Click here for extensive Microsoft macro documentation and examples.
Just for quick reference, here's the DOS info for DOSKEY (Run '
Edits command lines, recalls Windows 2000 commands, and creates macros. DOSKEY [/REINSTALL] [/LISTSIZE=size] [/MACROS[:ALL | :exename]] [/HISTORY] [/INSERT | /OVERSTRIKE] [/EXENAME=exename] [/MACROFILE=filename] [macroname=[text]] /REINSTALL Installs a new copy of Doskey. /LISTSIZE=size Sets size of command history buffer. /MACROS Displays all Doskey macros. /MACROS:ALL Displays all Doskey macros for all executables which have Doskey macros. /MACROS:exename Displays all Doskey macros for the given executable. /HISTORY Displays all commands stored in memory. /INSERT Specifies that new text you type is inserted in old text. /OVERSTRIKE Specifies that new text overwrites old text. /EXENAME=exename Specifies the executable. /MACROFILE=filename Specifies a file of macros to install. macroname Specifies a name for a macro you create. text Specifies commands you want to record. UP and DOWN ARROWS recall commands; ESC clears command line; F7 displays command history; ALT+F7 clears command history; F8 searches command history; F9 selects a command by number; ALT+F10 clears macro definitions. The following are some special codes in Doskey macro definitions: $T Command separator. Allows multiple commands in a macro. $1-$9 Batch parameters. Equivalent to %1-%9 in batch programs. $* Symbol replaced by everything following macro name on command line.
For this example, the UDIR, ULTRAEDITHOME, and EMACSHOME system variables were defined.
savemac=doskey /macros > "%UDIR%\doskey.mac" omac=p4 sync "%UDIR%\doskey.mac" $T p4 edit "%UDIR%\doskey.mac" $T "%ULTRAEDITHOME%\uedit32.exe" "%UDIR%\doskey.mac" loadmac=doskey /macrofile="%UDIR%\doskey.mac" $T echo Loaded macros from doskey.mac mac=doskey /macros $* listmac=doskey /macros $* n=notepad $1 get=p4 sync $* cue=p4 sync $* $T p4 edit $* $T "%ULTRAEDITHOME%\uedit32.exe" $* e="%EMACSHOME%\bin\runemacs.exe" $* ue="%ULTRAEDITHOME%\uedit32.exe" $* ci=p4 submit $1 co=p4 sync $* $T p4 edit $* lshist=p4 filelog -i $* lsh=p4 filelog $* sync=p4 sync $* showmac=doskey /macros $* openmac=p4 sync "%UDIR%\doskey.mac" $T p4 edit "%UDIR%\doskey.mac" $T "%ULTRAEDITHOME%\uedit32.exe" "%UDIR%\doskey.mac"
Last updated Fri, 20 Aug 2004, 18:54:40 ET