Opening a cmd window in the current working directory from cygwin

With the newer version of cygwin I am running, there are a few flaws. These mainly have to do with how it interacts with printing and user input from windows executables.


  • The windows python prompt doesn’t display. See here for more details.
  • Using mercurial, it can’t prompt me for a password. It comes up as abort: http authorization required

There are a few little niggly things like this which makes it handy to have the windows console available at your fingertips. You can launch cmd.exe from within cygwin, but that doesn’t solve the problem as you are still using the same input/output from the terminal. So I wrote a very simple script which will launch cmd in the current working directory.

Here it is:

# Written by: DGC

usage() {
  cat <<EOF
Usage: $(basename $0) <options>;

Opens a windows command window in the current working directory.

-h                 Display this message.

# Main
while getopts ":h?" option
  case $option in
      echo -e "Invalid option: -$OPTARG \n"

cygstart 'C:\Windows\System32\cmd.exe'

This is slightly overkill for essentially just cygstart 'C:\Windows\System32\cmd.exe', but I like to include a help with all my scripts.

It was helpful to me, so I thought I’d share it.

0 Responses to “Opening a cmd window in the current working directory from cygwin”

  1. Leave a Comment

What did you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Call Me
Endorse davidcorne on Coderwall



© 2013 by David Corne.

Creative Commons License

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

%d bloggers like this: