This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: cygwin.bat replacement ...

This is definitely a feature that I've always wanted somewhere deep inside,
but it for some reason it never occurred to me to do it...

Might I suggest a somewhat simpler solution?

This hack didn't work OOTB for me on my Win2K machine, but after getting the
gist of it, I noticed that the normal Cygwin.bat is minimalist.  It sets the
CYGWIN environment variable and runs bash, nothing else.  Not even a path
setting.  Everything else is handled in /etc/profile.

Why not create another batch file?  Cyg2.bat, perhaps?

Here's my solution (replace C:\Cygwin as necessary)...

@echo off
cd "%1"
SET CYGWIN=tty ntsec
C:\Cygwin\bin\bash --login -i

There was a line in my /etc/profile near the end that always set the current
path to the user's home directory (I might have added it myself, but I don't
remember...), so...

if test -z $CYG2; then cd "$HOME"; fi

test -f ./.bashrc && . ./.bashrc

The CYG2 environment variable simply blocks the cd that (among other
reasons, like using instead of cmd on Win2K) prevented your hack
from working OOTB on my machine.

The registry settings are almost the same...
Key: [HKEY_CLASSES_ROOT\Folder\shell\Bash Prompt Here\command]
Value Name: (Default)
Data Type: REG_SZ
Data: "C:\cygwin\cyg2.bat "%1""

I had a concern that this wouldn't work on drives other than C:, since cd
D:\ does not take you to the D: drive.  Fortunately, it works anyway.
Explorer sets the drive appropriately, I suppose.

Happy Computing!

Jason Alonso

-----Original Message-----
[]On Behalf Of Pabs
Sent: Monday, April 02, 2001 10:38 PM
Subject: cygwin.bat replacement ...

A possible replacement for the current cygwin.bat is attatched (~660 bytes)

You might need to bump up your env settings for cygwin.bat
-in the property sheet choose 'Memory' then change 'Initial Environment'

You will need to change all occurrences of <cygpath> with your cygwin
and the second last one should use double backslashes ('\\') instead of
ones as the folder separator.

It allows you to "Bash Prompt Here" if you set some registry settings:
Key: [HKEY_CLASSES_ROOT\Folder\shell\Bash Prompt Here\command]
Value Name: (Default)
Data Type: REG_SZ
Data: "C:\cygwin\cygwin.bat "%1""

It is a bit slow as a batch file so maybe an exe would be better.

Basically the strategy is:
remember the current directory
figure out where to cd to (%1 or %HOME% (construct if need be))
cd to that directory
bin/bash --login -i
cd back to the curent directory for people who called cygwin.bat from a
(sucky POS) prompt

Hope this is useful to some people
Bye, Pabs

Want to unsubscribe from this list?
Check out:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]