Commiting to Doskey

I recently wrote a little about using doskey but recently had a situation in which I thought it could be really handy. I often run the following set of commands with my many, small commits:

That’s quite a mouthful (fingerfull) but on Windows, aliases aren’t as plentiful as in Bash and writing a small batch file or PowerShell script for this seems overkill. Instead, simply do the following:

Let’s quicky break that down. “$t” tells doskey to start a new command. “$*” is doskey’s way of saying: take everything I add on the command line after the alias, and stick it here. The quotes are important though – that makes sure your commit message remains as one parameter. Also, in case you’re wondering, $1 is the first parameter, and so on.

So, to use it, you simply need to do the following:

Easy, right? If you want to save your little alias, you can echo out the ones it knows about with:

Now, to save them, just send the output to a file like so:

And to load them back in a new session:

You can find out more here should you want to.

twitterredditpinteresttumblrmail

Written by Stephen Moon
email: stephen at logicalmoon.com
www: https://www.logicalmoon.com


Hey! Did you enjoy reading this? If you did and would like an email when I add new content, just subscribe to my list. You can unsubscribe at any time.


Leave a Reply

Your email address will not be published. Required fields are marked *