While working under cygwin, is it possible to access Windows directories outside Cygwin's directory, e.g. Window's C:\Program Files\?

http://www.voxforge.org/home/docs/cygwin-cheat-sheet only mentions those subdirectoires under C:\cygwin, not those outside it.



It depends somewhat on how old of a cygwin distribution you have. See https://stackoverflow.com/questions/1850920/how-to-navigate-to-a-directory-in-c-with-cygwin

Basically, you should be able to do one of the following:

  • cd /cygdrive/c
  • cd c:
  • cd /c

Is it possible to access Windows directories outside Cygwin's directory?

Yes. mount your drives:

$ mount --help
Usage: mount [OPTION] [<win32path> <posixpath>]
       mount -a
       mount <posixpath>

Display information about mounted filesystems, or mount a filesystem

  -a, --all                     mount all filesystems mentioned in fstab
  -c, --change-cygdrive-prefix  change the cygdrive path prefix to <posixpath>
  -f, --force                   force mount, don't warn about missing mount
                                point directories
  -h, --help                    output usage information and exit
  -m, --mount-entries           write fstab entries to replicate mount points
                                and cygdrive prefixes
  -o, --options X[,X...]        specify mount options
  -p, --show-cygdrive-prefix    show user and/or system cygdrive path prefix
  -V, --version                 output version information and exit

Valid options are: acl,auto,binary,bind,cygexec,dos,exec,ihash,noacl,nosuid,notexec,nouser,override,posix=0,posix=1,sparse,text,user


$ mount
C:/cygwin/bin on /usr/bin type ntfs (binary,auto)
C:/cygwin/lib on /usr/lib type ntfs (binary,auto)
C:/cygwin on / type ntfs (binary,auto)
C: on /c type ntfs (binary,posix=0,user,noumount,auto)
E: on /e type vfat (binary,posix=0,user,noumount,auto)
F: on /f type ntfs (binary,posix=0,user,noumount,auto)
$ ls /c
'$Recycle.Bin'  books          'Documents and Settings'  Intel         'Program Files'        SPLASH.000  'System Volume Information'  Users                   Windows
_FS_SWRINFO     Config.Msi     Drivelists                music         'Program Files (x86)'  splash.idx  temp                         'VAIO Sample Contents'
apps            cygwin         games                     pagefile.sys  ProgramData            SPLASH.SYS  test                         VTRoot
AVScanner.ini   Documentation  hiberfil.sys              PerfLogs      projects               sysadmin    Update                       wamp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.