Jul 09 2008

Create Unix Aliases in Vista

Category: Software DevelopmentDmitry @ 6:47 pm

Its kind of funny –commands like ls, grep, find, cat etc are so wired into my hands, I always make a mistake of typing them even when I am using Windows. Its even a bigger problem for me, since I work for Microsoft and I develop on Windows all day. So what I usually do it (1) avoid cmd.exe completely :) and use powershell since it already has these aliases. (2) if I have to use cmd.exe I run these settings to remap things for my brain :) Enjoy.

To make cmd.exe more unix-like, do the following:

1. Create a shortcut:

Target

C:\Windows\System32\cmd.exe /k C:\Users\JohnDoe\Documents\profile.cmd

Start In

C:\Users\JohnDoe

2. Create Profile.cmd with contents:

@echo off

prompt [$p]$_$g

doskey ls=dir $*

doskey ll=dir $*

doskey cat=type $*

doskey ..=cd..

doskey grep=find “$1 $2

doskey mv=ren $*

doskey rm=del $*

doskey pwd=dir

echo Environment is set

-

Better yet, forget about it and just start using Powershell. Thats where its at! It already has aliases for both Unix and Windows commands, corresponding to the proper Powershell built-in commandlets.

Leave a Reply