Help producing Desktop Shortcuts using PowerShell.
hello,
i have following script in place:
$filepath="c:\test1"
get-childitem $filepath -recurse | ? {($_.length/1kb) -ge 50} | % {
write-host "found file more 50kb size. file name : $_.name"
move-item $_.fullname "c:\test2"
}
this searches test1 folder , finds files greater 50kb in size , moves files test2 folder.
now, wanted take files moved test2 folder , create shortcuts them on desktop/desktop path.
i found shortcut ps script may lead me in right direction needed assistance task. here script possibly work:
$desktop = [system.environment]::getfolderpath('desktop')
$shortcut = $shell.createshortcut("$desktop\clickme.lnk")
$shortcut.targetpath = "notepad.exe"
$shortcut.iconlocation = "shell32.dll,23"
$shortcut.save()
could looking , if so, best way implement it?
thank you.
tw
todd wozny
hi, if want create link folder c:\test2 should work:
$wshshell = new-object -comobject wscript.shell $desktop = [system.environment]::getfolderpath('desktop') $lnk = $wshshell.createshortcut($desktop+"\test2") $lnk.targetpath = "c:\test2" $lnk.save()
regards thomas paetzold visit blog on: http://sus42.wordpress.com
Windows Server > Windows PowerShell
Comments
Post a Comment