Search Windows and Linux Networking

Thursday, May 19, 2011

Create Shortcut on desktop with VBScript

Create Shortcut on desktop with VBScript

If you want to create shortcut on your desktop automatically on system boot. simply create or modify your logon script. for now we create simple "CreateShortCut.vbs" that create shortcut for the application given in

strprog = "application file Path " in following script you have to change only I had highlighted with yellow mark.

Open the notepad ant type following code , change as per your requirement and save the file as "CrateShortCut.vbs" then excute the file by simply double clicking on it. 

Option Explicit
Dim objshell
Dim strDesktop
Dim objshortcut
Dim strprog

strprog = "mspaint.exe"

Set objshell = CreateObject("WScript.shell")
strDesktop = objshell.Specialfolders("desktop")
set objshortcut = objshell.Createshortcut(strDesktop &"\Paint.lnk")
objshortcut.Targetpath = strprog
objshortcut.windowstyle =1
objshortcut.description = funfix(strprog)
objshortcut.workingdirectory = "c:\"
objshortcut.Iconlocation= strprog
objshortcut.hotkey = "CTRL+SHIFT+P"
objshortcut.save

Function funfix(strin)
funfix = instrrev(strin,".")
funfix = mid(strin,1,funfix)
End function

No comments:

Post a Comment