• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Tsukasa no Hibi

Cloudy Sky. Occasional Rain.

You are here: Home / Blog / Making Cygwin portable

Making Cygwin portable

2008-08-19 by tsukasa 3 Comments

One of the very packages I always install when I have to work with Windows is Cygwin. Being able to use my beloved GNU tools really makes things easier. Often I don’t have the option to install it. I grieved a little bit about the fact that some problems could be solved with just 2 commands that were — of course — missing from Windows’ horrendous command prompt. So I snooped around and built the following batch that’ll start a full-blown Cygwin session from i.e. portable harddisk:

@echo off set PATH=%CD%bin;%CD%sbin;%CD%usrsbin;%PATH set HOME=%CD%homePortable mount -bfu %CD%/ / mount -bfu %CD%bin /usr/bin mount -bfu %CD%lib /usr/lib cd %HOME% bash ----login -i

Easy, huh? All you have to do to make it work is renaming your /home/Username to /home/Portable (or simply adjust the setting in the batch). Pretty neat stuff.

Filed Under: Blog Tagged With: Cygwin, Portable App, Tips, Windows

Reader Interactions

Comments

  1. Wolfgang says

    2011-05-26 at 16:09

    it doesnt run.
    some errors i found. but monut option -b unknown

    here my test: please help

    @echo off
    echo Mein Dir: %CD%

    rem d:
    rem chdir %CD%\bin

    set PATH=%CD%\bin;%CD%\usr\sbin;%PATH
    set HOME=%CD%\home\homePortable

    mount -bfu %CD% /
    rem mount -bfu %CD%/bin /usr/bin
    rem mount -bfu %CD%/lib /usr/lib

    echo %HOME%

    cd %HOME%

    bash —-login -i

    pause

    Reply
  2. Tsukasa says

    2011-05-26 at 18:16

    Heya Wolfgang,

    I’m unable to test this thorougly but removing the “mount” lines altogether should do the trick. I didn’t read through the changelog but it doesn’t seem like the manual mount is necessary anymore (note: the original post was written in 2008, a lot has happened…).

    Please note that
    set PATH=%CD%\bin;%CD%\usr\sbin;%PATH
    should be
    set PATH=%CD%\bin;%CD%\usr\sbin;%PATH%

    From a few quick tests, the rest still works. If you run into problems, feel free to comment back.

    As for how I tested:
    – “Froze” my computer configuration with Try&Decide.
    – Downloaded the setup.exe from cygwin.com
    – Ran the default install to a portable harddisk.
    – Created the batch file, ran into the same mount error as you, REM’d the mount lines… success?
    – To make sure the changes would really work, I restarted the machine (thus eliminating all possible registry edits) and ran the batch again – still worked.
    – The test command chain I ran was something simple like “ls | grep pr”, so there might be problems in more complex applications.

    Reply

Trackbacks

  1. Bookmarks about Cygwin says:
    2008-10-21 at 04:00

    […] – bookmarked by 4 members originally found by MasakoX on 2008-10-01 Making Cygwin portable http://tsukasa.jidder.de/blog/2008/08/19/making-cygwin-portable – bookmarked by 2 members […]

    Reply

Leave a Reply to Bookmarks about CygwinCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Tags

.net AutoHotkey Bitcasa Blog C# Docker Fonts Fun Google Chrome Hardware How To Life Linux Mono Mplayer Music My NAS nVidia OBS OpenEdge OpenSSH Palaver Pangya! Portable App PowerShell Programming Quote RaiDrive Reminder Scripting Software Streaming Technology Tips twitter Video Virtualization VMware Web Windows Wine WordPress Wuala YouTube ZNC

Cool stuff

  • AdiIRC
  • Affinity Designer
  • Affinity Photo
  • AquaSnap
  • Arch Linux
  • Archive Team
  • ConEmu
  • Debian
  • Directory Opus
  • Far Manager
  • FileLocator Pro
  • Fluent Search
  • foobar2000
  • Forte Agent
  • IRCCloud
  • ISBoxer
  • Jetbrains Rider
  • Newsblur
  • OBS Studio
  • Obsidian.md
  • RaiDrive
  • Sublime
  • SyncBackPro
  • The Semware Editor
  • True Launch Bar
  • Vivaldi
  • Wavebox
  • WinHex
  • WinRAR
  • WinSCP
  • XYplorer
  • ZNC
  • Zoom Player Max

Semantic Web

  • Mastodon
  • Tsukasa no Hibi
  • Tsukasa no Hibi Sitemap

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Footer

About

Going since 2004, Tsukasa no Hibi is my personal blog about technology, media and sometimes society.

More about Tsukasa no Hibi

WordPress · Log in