Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com From: "Jason B. Alonso" To: , Subject: RE: cygwin.bat replacement ... Date: Tue, 3 Apr 2001 11:07:08 -0400 Message-ID: <000c01c0bc4f$c0f19530$3b03f712@mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <3ac93744.281e.0@crosswinds.net> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Importance: Normal 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)... Cyg2.bat ======== @echo off cd "%1" SET CYGWIN=tty ntsec SET CYG2=HOLD 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... /etc/profile ========= <--snip-to-end--> 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 command.com 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----- From: cygwin-owner AT sources DOT redhat DOT com [mailto:cygwin-owner AT sources DOT redhat DOT com]On Behalf Of Pabs Sent: Monday, April 02, 2001 10:38 PM To: cygwin AT cygwin DOT com 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 with your cygwin directory and the second last one should use double backslashes ('\\') instead of single 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 command.com (sucky POS) prompt Hope this is useful to some people Bye, Pabs -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple