Sub Create_ShortCut(ByVal TargetPath As String, ByVal ShortCutPath As String, ByVal ShortCutname As String, Optional ByVal WorkPath As String = "", Optional ByVal Window_Style As Short = 0, Optional ByVal IconNum As Short = 0)
Dim VbsObj As Object
VbsObj = CreateObject("WScript.Shell")
Dim MyShortcut As Object
ShortCutPath = ShortCutPath
MyShortcut = VbsObj.CreateShortcut(ShortCutPath & "" & ShortCutname & ".lnk")
MyShortcut.TargetPath = TargetPath
MyShortcut.WorkingDirectory = WorkPath
MyShortcut.WindowStyle = Window_Style
MyShortcut.IconLocation = TargetPath & "," & IconNum
MyShortcut.Save()
End Sub
Try
Call Create_ShortCut("c:windowssystem32explorer.exe", System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "", "Windows Explorer", , , )
Catch ex As Exception
End Try
# Create a Log Off shortcut
$AppLocation = "C:\Windows\system32\Shutdown.exe"
$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$env:Public\Desktop\Log Off.lnk")
$Shortcut.TargetPath = $AppLocation
$Shortcut.Arguments ="-L"
$Shortcut.IconLocation = "%SystemRoot%\System32\shell32.dll,44"
$Shortcut.Description ="Log out of Windows"
$Shortcut.WorkingDirectory ="C:\Windows\System32"
$Shortcut.Save()
# Create PowerShell ISE shortcut
$AppLocation = "%windir%\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe"
$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$env:Public\Desktop\PowerShell ISE.lnk")
$Shortcut.TargetPath = $AppLocation
#$Shortcut.Arguments ="-L"
$Shortcut.IconLocation = "$AppLocation,0"
$Shortcut.Description ="Load PowerShell ISE"
$Shortcut.WorkingDirectory ="%HOMEDRIVE%%HOMEPATH%"
$Shortcut.Save()
# Create TaskScheduler shortcut
$AppLocation = "%windir%\system32\taskschd.msc"
$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$env:Public\Desktop\Task Scheduler.lnk")
$Shortcut.TargetPath = $AppLocation
$Shortcut.Arguments ="/s"
$Shortcut.IconLocation = "%windir%\system32\miguiresource.dll,1"
$Shortcut.Description ="Load Task Scheduler"
#$Shortcut.WorkingDirectory ="%HOMEDRIVE%%HOMEPATH%"
$Shortcut.Save()
Originally Posted on December 14, 2013
Last Updated on December 10, 2019
Last Updated on December 10, 2019
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.