PowerShell for Non-N00bs: Creating Shortcuts
$shell = new-object -com wscript.shell
if($name)#create shortcut in same directory
{
$shortcut = $shell.createshortcut("c:\" + $name + ".lnk")
}
Else #create shortcut in specified directory
{
$shortcut = $shell.createshortcut($source + ".lnk")
}
$shortcut.targetpath = $source
if($Args -ne "") #set arguments for shortcut
{
$shortcut.Arguments = $Args
}
$shortcut.save()
Comments
- Anonymous
May 04, 2010
Thanks.. I've tried and it's work!