Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have been looking for a way to run dos batch files from the cygwin command line without having the enter the extension.

Would that be possible?

Currently, I have to enter the extension otherwise cygwin does not find the batch file.

share|improve this question

migrated from Dec 20 '12 at 5:25

This question came from our site for professional and enthusiast programmers.

Why do you want that? Anyway if your batch file is file.bat, try: 'cmd /C file' – golimar Jan 11 '13 at 10:18
As a work around you can add alias command='command.bat' in your shell .profile – kode Feb 8 '14 at 22:25

1 Answer 1

up vote 1 down vote accepted

I found no other solution so I did what golimar said.
Here is a simple script that looks for .bat files in a specific directory and creates aliases.
For example if there is a file git.bat in /some/path there will be a alias git that points to it.
Add this to your ~/.bashrc or ~/.zshrc or whatever you're using:

for f in /some/path/*.bat; do alias `basename "${f%.bat}"`=$f; done
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.