Can PowerShell 1.0 create hard and soft links analogous to the Unix variety?
If this isn\'t built in, can someone point me to a site that has a ps1 script that mimi
New-Symlink:
Function New-SymLink ($link, $target)
{
if (test-path -pathtype container $target)
{
$command = "cmd /c mklink /d"
}
else
{
$command = "cmd /c mklink"
}
invoke-expression "$command $link $target"
}
Remove-Symlink:
Function Remove-SymLink ($link)
{
if (test-path -pathtype container $link)
{
$command = "cmd /c rmdir"
}
else
{
$command = "cmd /c del"
}
invoke-expression "$command $link"
}
Usage:
New-Symlink "c:\foo\bar" "c:\foo\baz"
Remove-Symlink "c:\foo\bar"