Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Useful short aliases

Prefixing an asterisk disables alias expansion. START might be an alias to be expanded by the parser; *START will not be interpreted as an alias. This type of construction is sometimes used to prevent infinite recursion when using aliases to modify commands:

Code:
alias start=*start /pgm

Thank you.

This may prove useful in my sudo (elevate) alias that uses some Windows Task Scheduler trickery to elevate a program with out the pesky UAC dialog.
 
Well spotted that man. I can't even claim that it is in the version that I'm used to using (v7) because it seems to have disappeared from there too.
I used to have the exact same "trace" alias, guys! That's too funny.

Now, it's
alias trace=`BDEBUGGER %@QUOTE[%@SEARCH[%1]] %2$`
 
This is an alias to remove the current directory:

cr=`*set kgtemp=%_cwd %+ *cd .. %+ *rd "%kgtemp" >> NUL %+ if %_? NE 0 beep %+ if exist %kgtemp *cd %kgtemp %+ *unset kgtemp`
 
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.)

EI=elseiff
IEND=endiff

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...

FUNCTION kfilesize=`%@FORMAT[9,%@FILESIZE[%@QUOTE[%$],kc]]`

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.
 
Last edited:
I put these aliases in my tcstart.btm so I can quickly access the Desktop, Documents, or Dropbox folders:

Code:
alias desk:=%@shfolder[0]
alias docs:=%@shfolder[5]
alias drop:=%USERPROFILE%\Dropbox
 
I also find this alias indispensable:

Code:
PRE_INPUT=title %_cwd

I do something similar in PowerShell with a custom "Prompt" Function.
 
Has anyone created a set of aliases that would emulate the *nix bash shell?

Also, does anyone know of a repository or other central location for downloading files with aliases for ALIAS /R?
 
Back
Top