My version of "math" is called "dc" like in Unix (dc = desk calculator)... it repeats the expanded version of what you entered, plus a formatted EVAL:
dc=`echo %=t %$ = %@COMMA[%@eval[%$]]`
For C/C++ programmers who are always jumping between related directories, the following set is useful. I keep my source files in one directory and my include files in a parallel directory. I just type "inc" and "src" to flip between the two, even if they might be named differently in different projects. (If you structure your projects differently or use different folder names, you'll need to edit these.)
inc=`iff isdir ..\inc then %+ cd ..\inc %+ EI isdir ..\include then %+ cd ..\include %+ EI isdir ..\h then %+ cd ..\h %+ else %+ echo cannot find include dir %+ IEND`
src=`iff isdir ..\src then %+ cd ..\src %+ EI isdir ..\source then %+ cd ..\source %+ EI isdir ..\sql then %+ cd ..\sql %+ else %+ echo cannot find source dir %+ IEND`
raw=`iff isdir ..\RawData then %+ cd ..\RawData %+ EI "%@EXPAND[..\Raw*]" != "" then %+ cd "%@FIELD[0,%@EXPAND[..\Raw*]]" %+ EI "%@EXPAND[..\*Raw*]" != "" then %+ cd "%@FIELD[0,%@EXPAND[..\*Raw*]]" %+ else %+ echo cannot find data dir %+ IEND`
Sometimes I want to look at a file (such as a batch file) and I'm not sure where it is. This finds it and lists it all in one step:
flist=`list %@EXECSTR[ which %$ ]`
Want to see ALL timestamps on a set of files, broken up by type of timestamp?
I'm not using backquotes here because the alias needs to include them in places. You'd put these in an aliases source file for them to work. This was written for earlier versions of Take Command, so you might want to replace %@UPPER with %@CAPS if you have it. (It looks nicer.) You'll also need the function @kfilesize if you want the file sizes to line up nicely...
sepln=*echo %@REPEAT[_,%_columns] %+ *echo.
tdir=(echo. %+ echo. %+ sepln) %+ for %xx in (created written accessed) do (echo. %+ echo `%=e[1m`%@UPPER[%xx]:`%=e[0m` %+ *pdir /d/a:/T%@LEFT[1,%xx] /(dy-m-d th:m:sd a @kfilesize[*]k fn) %$ %+ echo. %+ sepln )
And here's one that lets me review what I'm doing before I clobber a whole directory tree:
zap=`setlocal %+ set aa=N %+ *del /N /a: /e/k/x/y/z %$ %+ inkey /w9/k"yn" %=e[1;33;40m`REALLY delete the above? [y/N]: `%=e[0;37;40m %%aa %+ if "%aa" == "Y" *del /a:/e/k/x/y/z %$ %+ endlocal`
Of course, you can replace "%+" with "&" if you use the default command separator, and/or replace "%=" with "^" if you use the default escape-sequence character.