Symlinks for Windows

Being primarily a Linux user at home, I’m very much a fan of symlinks. It provides an easy way to reference a file or directory without the need to duplicate content, and thus unnecessarily taking up storage space. Those who’ve only used the Windows OS will probably never understand the usefulness of symlinks, if you’re one, I suggest that you read the link I’ve provided earlier before proceeding.

For example, let’s say I have a PHP script here on HTNet, called demoscript.php. I not only want to show what this script does, but also how I did it (ie. the programming involved). Since HTNet is hosted on a Linux machine, I can just create a symlink to demoscript.php called demoscript.txt via the following command:

ln -s demoscript.php demoscript.txt

By doing so, if someone views demoscript.php via a web browser he/she will see the script’s output, while if he/she were to view demoscript.txt, the script’s source code will be shown. The best thing is, symlinks only take up a few bytes while the script itself can be quite big.

Which is why I’m very excited to discover NTFS Link. It provides some symlinking abilities to the NTFS filesystem. I wish there was some way to create the symlinks via command line (so I can use it via PHP scripts on Win32 hosted systems, or batch files), but this doesn’t seem possible in the latest release. The only way I can find out for sure is when I try it out at work on Monday.

3 responses to “Symlinks for Windows”.

  1. farking Says:

    i think rename it to demoscript.phps is better though 🙂

  2. Site Admin Azmeen Says:

    Heh, the only reason I didn’t was because I’m too paranoid to enable the phps filetype from being rendered on my servers 😛

  3. farking Says:

    well in that case. hope .txt rendering won’t do harm..ehe :p