Recently I facilitated problem that there is no easy way to create alias to most useful apps in Windows command line. I found some hacks they require registry modifications and so one. So because of lag of this feature I decided to simplify my workflow and I created simple Python script.
Solution is simple and quite straight forward. Each new alias will be created as a bat file with right name. Assuming that main folder of aliases will be added to system PATH everything should work fine.
Script provides simple API:
- add: add specific alias for given path
- rem: remove alias with name
- list: list all registered aliases
- get: shows run script for specific alias
- Create aliases for command line applications and GUI applications. GUI applications requires –fork flag to do not block command line until application stop.
- Pass invoke parameter of alias to destination program. Let’s assume that you created alias for notepad using:
1alias add n notepad --fork
- Open command line
- Create folder for aliases:
- Add this folder to system PATH
- “My Computer” > “Properties” > “Advanced” > “Environment Variables” > “Path”
- Append to PATH:
- Go to this folder:
- Clone script:
1git clone https://github.com/asRIA/alias.git .
- Register this script as an alias
1python C:\Users\Piotr\aliases\alias.py add alias python C:\Users\Piotr\aliases\alias.py
- Start to use alias command
Depending on current needs, maybe I will add Linux, and MacOs support (but I assume they have own system for aliases).
Other nice feature it could be “setup” command which will register alias to invoke alias.py script. Will be great to auto register path to folder in system PATH.
More info and current state at: https://github.com/asRIA/alias