How can I access Windows directories outside Cygwin's directory

1

1

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.

Thanks.

Tim

Posted 2017-02-09T20:40:06.360

Reputation: 12 647

a very good question. i never thought about it.. – yoyo_fun – 2017-02-09T20:44:20.220

Answers

3

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

Brick

Posted 2017-02-09T20:40:06.360

Reputation: 173

1

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

Example:

$ 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

DavidPostill

Posted 2017-02-09T20:40:06.360

Reputation: 118 938