## Monday, November 16, 2009

### Gotcha Of The Day: junctions don't work on Windows 7

I was setting up my dev environment on my new laptop and I ran into some strange file access issues with junction points I have in my web tree.

Both cygwin and cmd.exe showed the junction points I created as valid, yet PHP's require_once couldn't read them.

I did notice some strange output in the DOS listing of the junction point which got me concerned:

11/16/2009  05:47 PM         foo [\??\C:\Users\ben\bar]


After a bit of poking around, I learned something amazing - Windows 7 now comes with soft and hard links built in. The right command to use is mklink.

I replaced my old call of:

  junction target existing-dir


with:

 mklink /J target existing-dir


And now the link was created correctly - PHP, cmd.exe and Cygwin were all happy.

I'm amazed. Finally, Windows gets file links. Look at that, baby's growing up.