How to create a shortcut on Windows

(imported topic written by SystemAdmin)

I’m trying to figure out if I can use the BF language to create a Windows shortcut. According to the Windows Inspector Library doc “Shortcuts to files can be constructed in the file system.” and it lists a creation method “shortcut of : Creates a shortcut object for the file. If the file is not a shortcut, this property does not exist.”

I can’t find any examples for shortcut creation. Can anyone shed some light on this?

Thanks!

Rames

(imported comment written by BenKus)

Hi rames,

The relevance language is a query language that is good for looking up data, but doesn’t actually “do” anything.

To create a shortcut, you will need to use the Action Language. It will be easiest to do this through a shortcut making utility or through a vbscript. I found this:

http://www.ss64.com/nt/shortcut.html

So for example, you can do this in a BES action:

appendfile Set oWS = WScript.CreateObject(“WScript.Shell”)
appendfile sLinkFile = "C:\MyShortcut.LNK"
appendfile Set oLink = oWS.CreateShortcut(sLinkFile)
appendfile oLink.TargetPath = "C:\Program Files\MyApp\MyProgram.EXE"
appendfile ’ oLink.Arguments = ""
appendfile ’ oLink.Description = "MyProgram"
appendfile ’ oLink.HotKey = "ALT+CTRL+F"
appendfile ’ oLink.IconLocation = "C:\Program Files\MyApp\MyProgram.EXE, 2"
appendfile ’ oLink.WindowStyle = "1"
appendfile ’ oLink.WorkingDirectory = "C:\Program Files\MyApp"
appendfile oLink.Save

move __appendfile makeshortcut.vbs

waithidden “{pathname of system folder & “\cscript.exe”}” makeshortcut.vbs

Note that “waithidden” is a BES 6.0+ command and you can use “wait” for pre-BES 6.0 Clients, but it might temporarily show a dos box.

Ben