This is the mail archive of the cygwin@sources.redhat.com 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]

Bash Prompt Here


Hi,

I've come up with a way to right-click on a directory in Windows Explorer 
and have a menu option called "Bash Prompt Here" that will open a bash 
prompt with the selected directory as the current one.  It's a bit kludgy, 
but I thought I'd submit it for any who may find it useful.  Works under 
Win98 and WinME.  Be interested to know how it goes on NT variants.

This is using cygwin 1.x and assumes that your cygwin installation is in 
"c:\cygwin" which is mounted as your root directory.  Change to suite your 
own environment.

Create a file "c:\cygwin\start_at.bat" with the following three lines:

	@echo off
	echo cd %1 > c:\cygwin\start_dir.txt
	c:\cygwin\cygwin.bat

Add the following four lines to the end of "/etc/profile" (or 
"c:\cygwin\etc\profile"):

	if [ -f /start_dir.txt ] ; then
	  . /start_dir.txt
	  rm /start_dir.txt
	fi

Lastly, apply the following registry patch file (which I name 
"bash_prompt_here.reg"):
----------snip----------
REGEDIT4

[HKEY_CLASSES_ROOT\Directory\shell\BashHere]
@="&Bash Prompt Here"

[HKEY_CLASSES_ROOT\Directory\shell\BashHere\command]
@="C:\\WINDOWS\\COMMAND.COM /E:4096 /c C:\\cygwin\\start_at.bat \"%L\""

----------snip----------

That's it.  If anybody can offer any improvements, let me know.

E.


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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