Skip to content

Instantly share code, notes, and snippets.

@jihan917
Created October 27, 2010 08:10
Show Gist options
  • Save jihan917/648653 to your computer and use it in GitHub Desktop.
Save jihan917/648653 to your computer and use it in GitHub Desktop.
doskey macrofile - (quick and dirty) *nix shell simulation for cmd.exe
;= doskey.mac - posix shell style aliases for cmd.exe
;= place it under %AppData% and create a shortcut to
;= C:\Windows\System32\cmd.exe /k "doskey /macrofile=%AppData%\doskey.mac"
;= beware, this is very crippled *nix shell simulation.
;= --``why not go ahead and use bash/ksh/etc?''
;= --``no I don't. shell on Windows just sucks.''
;= I use these aliases to save me a few (otherwise-would-be) typos;
;= for anything more than a few lines,
;= python/ruby (or perl, for that matter;-) is far better than shell.
;= (C) Copyright 2009, Ji Han (jihan917<at>yahoo<dot>com).
[cmd.exe]
;= straightforward
clear=cls
history=doskey /history
pwd=cd
;= this is a bit out of alignment ;-)
top=taskmgr
;= the following barely resembles their linux counterparts,
;= thus no parameter is allowed to be passed.
ifconfig=ipconfig
ps=tasklist
;= the following accepts arguments but not options.
cat=type $*
cd=if [$*]==[] (cd %UserProfile%) else (cd $*)
cp=xcopy $*
grep=findstr $*
less=more $*
ll=dir /l /od /q $*
ls=dir /l /w $*
man=help $*
mv=move $*
rm=del $*
which=where $*
;= editors
emacs=start /b runemacs $*
vi=start /b gvim $*
vim=start /b gvim $*
;= take a peek at what black magic has been done,
;= and revoke anything untastful.
alias=if [$*]==[] (doskey /macros) else (doskey $*)
unalias=for %a in ($*) do @(doskey %a=)
;= semicolon is unintended. my dirty little hack to put down comments. ;-)
;=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment