X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=0.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,TW_YG,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: <4CED0E0D.4080106@bonhard.uklinux.net> References: <4CED0E0D DOT 4080106 AT bonhard DOT uklinux DOT net> Date: Wed, 24 Nov 2010 15:31:51 -0400 Message-ID: Subject: Re: Portable Cygwin: replacing drivename in a text file From: Lee To: cygwin AT cygwin DOT com Cc: Fergus Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On 11/24/10, Fergus wrote: > Running Cygwin off a portable USB stick. > > Different host machines typically allocate a different drivename to the > stick. > > Previous use, say it was J:. A not-quite-portable application needed a > settings.ini file built with many occurrences of the string > j:\usr\local\bin. The file was built and saved. > > Current use: now it's K:. > > I could re-configure settings.ini with > sed -i 's/j:/k:/g' settings.ini > but in general I don't know (and don't want to bother with) what the > drivename labels were, or are. Something like > sed -i 's/.:\\/ replacementstring /g' settings.ini > will in fact be sufficiently strong to make the change olddriveletter: > to newdriveletter: where, and only where, I need it, but experiment as I > might with > replacementstring = cygpath -w > replacementstring = `cygpath -w` > and other variations, I can't get the syntax quite right. > > Can anybody help, please? Thank you very much. I put a .bat file on each machine to run the portable app that looked like subst X: K:\ .. invoke app .. subst X: /d Adjust the "subst X: [local drive letter]:\" to each machine and no more drive letter issues :) But then I started wanting to carry around my own data as well as portable apps on the USB stick & went with whole drive encryption with truecrypt. The .bat file on each machine changed to @rem mountvol to find out the volume name @rem c:\TrueCrypt\TrueCrypt.exe /q /v \\?\Volume{..output from mountvol..}\ /l X .. invoke app .. c:\TrueCrypt\TrueCrypt.exe /q /dX HTH, Lee -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple