Simple Bash-Like Aliases on Windows
To get the global Bash aliases in Windows for applications that are not automatically added to the path without manually adding each of them, here is the cleanest solution that I came up with that makes the minimum number of changes to and has the maximum flexibility for subsequent configuration:
Set your alias path
mkdir c:\aliases setx PATH "c:\aliases;%PATH%"
Add your nickname
Open shell in a new window
To start C:\path to\my program.exe , passing all the arguments, opening it in a new window, create the file c:\aliases\my program.bat with the following contents (see NT Start Command for more information on the start command):
@echo off start "myprogram" /D "C:\path to\" /W "myprogram.exe" %*
Running in the current shell window
To start C:\path to\my program.exe , passing all the arguments, but running it in the same window (more similar to how bash works), create a file c:\aliases\my program.bat with the following contents:
@echo off pushd "C:\path to\" "my program.exe" %* popd
Run in window of current shell 2
If you do not need an application to change the current working directory in general to work, you can simply add a symbolic link to the executable file inside your aliases folder:
cd c:\aliases\ mklink "my program.exe" "c:\path to\my program.exe"
Erasmus Jun 16 '17 at 15:56 on 2017-06-16 15:56
source share