Make hard-link from Windows' Desktop to cygdrive

3

When I open Cygwin, I want that I can see the Desktop -folder (I do not want to move its original location, I think the thing I want is hard-link with ln -cmd -- but not sure, this is my first idea to do it -- it is possible that there is some other way to do it, sorry I am now forgetting how do it in *ix boxes apparently -- I tried it the W-way by creating a shortcut but I messed up after cp-ing the files etc, not working). This is probably an easy puzzle, some clever ideas out there how to accomplish the goal to use the Desktop fast with Cygwin?

$ pwd
/home/hhh
$ mkdir Desktop
$ ln /cygdrive/c/Documents\ and\ Settings/hhh/Desktop/* Desktop

user114739

Posted 2012-02-16T12:14:27.003

Reputation:

The Windows Desktop isn't a physical directory. It's created by Explorer.EXE and can contain items from many different places. The user profile is just one source. – MSalters – 2012-02-16T12:54:28.207

1

@MSalters: It is both a physical directory and a virtual folder. The user profile is usually considered the primary source.

– user1686 – 2012-02-16T13:47:37.247

@grawity: You might want to re-read the link you gave. It's indeed a virtual folder, but that does mean it cannot be a physical directory: a virtual folder is defined as a folder which isn't a physical directory. – MSalters – 2012-02-16T13:54:03.860

Answers

2

I've always solved the problem by setting the Windows User environment variable HOME to be %USERPROFILE%. (%USERPROFILE% always maps to where the user's profile is stored, usually under "C:/Documents and Settings/".)

Cygwin respects HOME and wil make that the home directory for the user.

jwernerny@machine ~
$ pwd
/cygdrive/c/Documents and Settings/jwernerny

From there, Desktop is already a sub-directory.

BTW, Windows environment variables are set from the Advanced tab in the System Properties of the Control Panel in Windows up to XP. I'm not sure on later versions if it is still the same.

jwernerny

Posted 2012-02-16T12:14:27.003

Reputation: 951

...could you give some cmd, I am lost what you mean. Sorry I am newbie with W, percentages? C:/ yes yes some paths but please use absolute paths...I see C:/ is some alias, ok...investigating. I am becoming ill to this, hard to even communicate precisely about W -- using some W mock-Pro 7 when the dev-branch is 6?! Inconsistence?! It would be cool if there was some optimized W available doing this kind of things automatically... – None – 2012-02-16T21:29:53.053

@hhh In windows, %var% is the same as writing $var in Unx shell. See Wiki Article on Environment Variables for more on Windows and Unx settings. From a command prompt, you would issue set HOME=%USERPROFILE% to set HOME to the folder above your Desktop. The problem is this only works as long as the cmd window is open. To make it permanent, you need to set it using the procedure in Setting Win7 Env variables.

– jwernerny – 2012-02-17T13:26:09.020

1

You can use a symbolic link, but you have to create it to the Desktop directory itself, not to its contents.

rm -rf ~/Desktop
ln -s "/cygdrive/c/Documents and Settings/hhh/Desktop/" ~/Desktop

It will be accessible as ~/Desktop.

user1686

Posted 2012-02-16T12:14:27.003

Reputation: 283 655

I cannot see the content of my Desktop (the thing I can see when Windows opens up) in the dir Desktop -- $ mkdir ~/Desktop; ln -s "/cygdrive/c/Documents and Settings/hhh/Desktop/" ~/Desktop. – None – 2012-02-16T21:22:49.007

0

Well.. i know it's not quite what you are looking for but why don't you just create an alias like:

$ alias cdd="cd /cygdrive/c/Users/[your-username]/Desktop"

Then you could just type it in the command prompt to jump right in your Desktop folder like this

$ cdd

/cygdrive/c/Users/[your-username]/Desktop $

It's a good practice to save your aliases in your dotfiles which run at login, like ~/.bashrc for example. Doing so, will ensure you will have the cdd alias handy each time you login.

Hope it helps!

ovidb

Posted 2012-02-16T12:14:27.003

Reputation: 101