> -----Original Message----- > From: Takashi Yano <takashi.y...@nifty.ne.jp> > Sent: 19 July 2023 03:15 > To: cygwin@cygwin.com > Cc: Orit Heimer <heimer.o...@gmail.com> > Subject: Re: Cygwin64 does not show my desktop directories > > On Wed, 19 Jul 2023 11:52:31 +0300 > Orit Heimer wrote: > > Hello to all, > > I am new to Cygwin64 and encountered a problem. > > I am using a Windows 10. > > I try to get cygwin64 to show my desktop directories. > > I use the following command to change to this directory: > > *cd /cygdrive/c/Users/Default/Desktop* > > But when I then use *ls* I get nothing. > > I suspect this is a permission problem, but I failed to overcome it. > > The directory you cd'ed is not correct. > Use: > /cygdrive/c/Users/$USER/Desktop > > -- > Takashi Yano <takashi.y...@nifty.ne.jp>
If you can "cd" to a directory and "ls" shows it empty, permissions are unlikely to be the problem. Though the original example used "C:", the Windows desktop need not be on the C: drive. Assuming you're using bash, a more general command is: cd "${USERPROFILE}/Desktop" - Quoted because doing that helps to remind me that its safer. - ${USERPROFILE} because it includes the Windows drive. - "Desktop" instead of "desktop" because, though case-sensitivity is usually not enabled, the directory name is "Desktop". Also, it is possible that the directory that Windows Explorer shows as your desktop is something entirely different. For example, if you use OneDrive to mirror your desktop, the directory that Windows Explorer shows is "${OneDrive}/Desktop". And, at least on my system, Here, the quotes are necessary. I believe that OneDrive isn't the only thing that can change the "real" location of what Windows Explorer shows: The following command should always work but will emit "bash: warning: command substitution: ignored null byte in input". In case email makes a mess of the command, it is 128 characters. ls -ld "$(cat "/proc/registry/HKEY_CURRENT_USER/SOFTWARE/Microsoft/Windows/CurrentVersion/Explorer/User Shell Folders/Desktop")" If you don't like to see the warning and you want to have a variable that holds the desktop directory name, this works. Again, to help in case email makes a mess of it, the command is 202 characters. IFS= read -r -d '' WINDOWS_DESKTOP < "/proc/registry/HKEY_CURRENT_USER/SOFTWARE/Microsoft/Windows/CurrentVersion/Explorer/User Shell Folders/Desktop" && WINDOWS_DESKTOP="$(cygpath "${WINDOWS_DESKTOP}")" You can use the variable, like so: ls -ld "${WINDOWS_DESKTOP}" -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple