I need to do this without installing software...
MSDOS (cmd.exe) on Windows XP
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
Are you talking about MS-DOS or Windows XP?
Since it's likely that you're just talking about doing this from a command-prompt on Windows XP I'll answer for that case first... >smile<
On an NTFS volume under Windows XP you can use the "fsutil" tool to create a hard link:
fsutil hardlink create <destination filename> <source filename>
Both source and destination must be on the same NTFS volume.
MS-DOS only supports the FAT filesystem (in various flavors). FAT doesn't "officially" support hard links. You could create the effect of a hard link by having two directory entries that refer to the same FAT chain. This would be detected as an "error" by CHKDSK and repaired, however.
If you didn't mind manipulating directory structures by hand using DEBUG you could get this done w/o installing any software. It wouldn't be pretty, but it would work.
As I said, though, it's technically illegal to have two directory entries point to the same FAT chain. Running a disk defragmenter on such a volume would probably damage the filesystem. CHKDSK would definitely see such a "jury-rigged hard link" as a filesystem error.
fsutil hardlink works only for files. If you want to make link to directory, you could use junction from sysinternals package.
Be aware: if you try to delete link, contents of destination directory would be also deleted. To remove link, you should use
juncion -d switch.
You could recognize links in Total commander: they have different icon than directories. In windows explorer these links looks the same as any directory.
First off, you better be aware that cmd.exe is NOT MS-DOS, and that there are no remaining vestiges of DOS in any version of Windows these days. DOS died following Windows 95/98/ME, XP and it's successors were built on NT, which never had any DOS in it. cmd.exe is a native Windows application that superficially appears as a command-line and is capable of accepting commands similar to old DOS commands, but it is NOT DOS.
Secondly, before you go creating hard links in Windows, you will want to have a read of, and understand, this: http://blogs.msdn.com/oldnewthing/archive/2009/09/28/9900082.aspx
Finally, to do the dirty work itself, use fsutil as Evan describes above, or as is documented here: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/fsutil.mspx?mfr=true