Jump to content

Creating a desktop shortcut...


Recommended Posts

Hi.

I have a few programs (plugins actually) that do not have an install routine - they are just copied to a program file directory and a shortcut placed on the desktop - the shortcut then opens the plugin, which opens the main program.

What I want to know is how do I do this in an unattended install?

Fury

Link to comment
Share on other sites


If your unattended install if for you only and for the same drive then put shortcuts in these folders

$OEM$\$Docs\All Users\Desktop

$OEM$\$Docs\All Users\Start Menu\Programs\

BUT if you need your installation to work on many computers or drive you should use a program like SHORTCUT.EXE for creating shortcuts because in a LNK file (*.lnk) there is informations about computer name and drive so to do it clean you should use SHORTCUT.EXE

SHORTCUT.EXE

Link to comment
Share on other sites

jdoe is right.

If your CD is going to be used where the shortcut-ed apps won't stay in C:\ drive (maybe you want to install on D: drive), then you should use variables in the .LNK path.

For example, change the "target" for ZoneAlarm from

"C:\Program Files\Zone Labs\ZoneAlarm\zlclient.exe"

to this:

"%ProgramFiles%\Zone Labs\ZoneAlarm\zlclient.exe"

That way, it is "portable" across different setups of windows.

I prefer to use as few third-party apps as possible, so I don't use the (OptimumX) shortcut, and do setting up manually.

Link to comment
Share on other sites

@prathapml is right but it won't remove computer name in the *.LNK

On a network a shortcut from an other computer could try to start the program from the remote computer and not the local.

In your case I don't think this is important but there is few things to know about shortcuts because strange behavior could happen.

For installing your programs there is always VBScript with which you can install and create shortcuts (no need of shortcut.exe)

Link to comment
Share on other sites

Here is a sample of a vbScript I use during my unattended builds. This one will create a shortcut on the desktop and on the Quick Launch toolbar for Windows Explorer.

'Create Windows Explorer Desktop icon

Set Shell = CreateObject("WScript.Shell")

DesktopPath = Shell.SpecialFolders("AllUsersDesktop")

Set link = Shell.CreateShortcut(DesktopPath & "\Explorer.lnk")

link.Arguments = "/n,/e,c:\"

link.Description = "Explorer link"

link.HotKey = "CTRL+ALT+SHIFT+E"

link.IconLocation = "%SystemRoot%\explorer.exe"

link.TargetPath = "%SystemRoot%\explorer.exe"

link.WindowStyle = 1

link.WorkingDirectory = "%HOMEDRIVE%%HOMEPATH%"

link.Save

'Create Windows Explorer Quick Launch icon

Const OverwriteExisting = True

Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FolderExists("C:\Documents and Settings\Administrator\Application Data\Microsoft\Internet Explorer\Quick Launch\") Then

objFSO.CopyFile "C:\Documents and Settings\All Users\Desktop\Explorer.lnk" , "C:\Documents and Settings\Default User\Application Data\Microsoft\Internet Explorer\Quick Launch\", OverwriteExisting

Else

Set objFolder = objFSO.CreateFolder("C:\Documents and Settings\Default User\Application Data\Microsoft\Internet Explorer\Quick Launch\")

objFSO.CopyFile "C:\Documents and Settings\All Users\Desktop\Explorer.lnk" , "C:\Documents and Settings\Default User\Application Data\Microsoft\Internet Explorer\Quick Launch\", OverwriteExisting

End If

If objFSO.FolderExists("C:\Documents and Settings\Administrator\Application Data\Microsoft\Internet Explorer\Quick Launch\") Then

objFSO.CopyFile "C:\Documents and Settings\All Users\Desktop\Explorer.lnk" , "C:\Documents and Settings\Administrator\Application Data\Microsoft\Internet Explorer\Quick Launch\", OverwriteExisting

Else

Set objFolder = objFSO.CreateFolder("C:\Documents and Settings\Administrator\Application Data\Microsoft\Internet Explorer\Quick Launch\")

objFSO.CopyFile "C:\Documents and Settings\All Users\Desktop\Explorer.lnk" , "C:\Documents and Settings\Administrator\Application Data\Microsoft\Internet Explorer\Quick Launch\", OverwriteExisting

End If

objFSO.CopyFile "C:\Documents and Settings\All Users\Desktop\Explorer.lnk" , "C:\Documents and Settings\Default User\Application Data\Microsoft\Internet Explorer\Quick Launch\", OverwriteExisting

Hope this helps.

tguy

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...