May 24, 2014

Useful utility: doskey

Leia este post em Português

If you use the Windows console in your everyday tasks you probably is a very sad person :)

Let me explain, you should move to a better console ;) And we have a couple of options (as I stated here).

But this is not the focus of this post. My point is, if you rely on a console on Windows (whenever cmd.exe, ConEmu, whatever) and you want to be able to create aliases to applications you can use a built in command (at least on Windows 7 / 8) called doskey (you can find it in %windir%\System32\doskey.exe) (it probably exists on all Windows versions all way down to Windows 3.0 and even to DOS 4.2 - I remember using it on such OSs :).

For instance, if you want to make it more convenient to open a text file in Sublime (or any other text editor) type the following command at your console (replacing the path to sublime executable with the path to your text editor:
doskey subl = "%ProgramFiles%\Sublime Text 2\sublime_text.exe" $* 
and from now on, on that console, you can simply type:
subl my-text-file.ext
and your file will open in Sublime!

Hope you find this info useful.

Happy coding.

No comments: