Jump to content

Creating shortcuts at installation time


Yzöwl

Recommended Posts

Thought this may help people out, I apologise if a similar method has been posted previously, but I couldn't find one in my searches.

Before the cleanup routine is called in runoncex.cmd, add the lines similar to the following:

REG ADD %KEY%\045 /VE /D "Adding user defined shortcuts" /f
REG ADD %KEY%\045 /V 1 /D "rundll32 setupapi,InstallHinfSection Shortcuts 128 %systemdrive%\Apps\Standalone\shortcuts.inf" /f

Now create a shortcuts.inf file similar to this:

[Version]
Signature=$CHICAGO$

[Shortcuts]
UpdateInis=AddLink

[AddLink]
;adds shortcut to ERUNT.exe within %ProgramFiles%\Standalone\ERUNT folder to %USERPROFILE%\Start Menu\Programs\Standalone\ERUNT
setup.ini, progman.groups,, "group1=""%16386%\Standalone\ERUNT\"""
setup.ini, group1,,"""ERUNT"",""""""%16422%\Standalone\ERUNT\ERUNT.EXE"""""""

;adds shortcut to README.TXT within %ProgramFiles%\Standalone\ERUNT folder to %USERPROFILE%\Start Menu\Programs\Standalone\ERUNT
setup.ini, progman.groups,, "group2=""%16386%\Standalone\ERUNT\"""
setup.ini, group2,,"""Readme"",""""""%16422%\Standalone\ERUNT\README.TXT"""""""

;adds shortcut to NTREGOPT.EXE within %ProgramFiles%\Standalone\ERUNT folder to %USERPROFILE%\Start Menu\Programs\Standalone\ERUNT
setup.ini, progman.groups,, "group3=""%16386%\Standalone\ERUNT\"""
setup.ini, group3,,"""NTREGOPT"",""""""%16422%\Standalone\ERUNT\NTREGOPT.EXE"""""""

;adds shortcut to Restoration.exe within %ProgramFiles%\Standalone\Restoration folder to %USERPROFILE%\Start Menu\Programs\Standalone\Restoration
setup.ini, progman.groups,, "group4=""%16386%\Standalone\Restoration\"""
setup.ini, group4,,"""Restoration"",""""""%16422%\Standalone\Restoration\Restoration.exe"""""""

;adds shortcut to SyncBack.exe within %ProgramFiles%\Standalone\SyncBack folder to %USERPROFILE%\Start Menu\Programs\Standalone\SyncBack
setup.ini, progman.groups,, "group5=""%16386%\Standalone\SyncBack\"""
setup.ini, group5,,"""SyncBack"",""""""%16422%\Standalone\SyncBack\SyncBack.exe"""""""

;adds shortcut to SYNCBACK.HLP within %ProgramFiles%\Standalone\SyncBack folder to %USERPROFILE%\Start Menu\Programs\Standalone\SyncBack
setup.ini, progman.groups,, "group6=""%16386%\Standalone\SyncBack\"""
setup.ini, group6,,"""SyncBack Help"",""""""%16422%\Standalone\SyncBack\SYNCBACK.HLP"""""""

;adds shortcut to popcorn.exe within %ProgramFiles%\Standalone\PopCorn folder to %USERPROFILE%\Start Menu\Programs\Standalone\PopCorn
setup.ini, progman.groups,, "group7=""%16386%\Standalone\PopCorn\"""
setup.ini, group7,,"""Ultrafunk Popcorn"",""""""%16422%\Standalone\PopCorn\popcorn.exe"""""""

;adds shortcut to popreadme.txt within %ProgramFiles%\Standalone\PopCorn folder to %USERPROFILE%\Start Menu\Programs\Standalone\PopCorn
setup.ini, progman.groups,, "group8=""%16386%\Standalone\PopCorn\"""
setup.ini, group8,,"""Readme"",""""""%16422%\Standalone\PopCorn\popreadme.txt"""""""

;for meanings of %16386% and %16422% see listings below
;
; Common DIRID Listing,
;
; Destination Directories
;
; 01 - SourceDrive:\pathname      (the directory from which the INF file was installed)
; 10 - Windows directory      (%SystemRoot%)
; 11 - System directory       (%SystemRoot%\system32 -NT-, %SystemRoot%\system -Win9x/Me-)
; 12 - Drivers directory      (%SystemRoot%\system32\drivers -NT-, %SystemRoot%\system\IoSubsys -Win9x/Me-)
; 17 - INF file directory      (%SystemRoot%\inf)
; 18 - Help directory       (%SystemRoot%\Help)
; 20 - Fonts directory       (%SystemRoot%\Fonts)
; 24 - Root directory of system disk (%SystemDrive%)
; 25 - Shared directory       (%ALLUSERSPROFILE%\Shared Documents)
; 53 - User profile directory      (%USERPROFILE%)
;
; Shell Special Folders
;
; 16419 %ALLUSERSPROFILE%\Application Data
; 16409 %ALLUSERSPROFILE%\Desktop
; 16430 %ALLUSERSPROFILE%\Documents
; 16437 %ALLUSERSPROFILE%\Documents\My Music
; 16438 %ALLUSERSPROFILE%\Documents\My Pictures
; 16439 %ALLUSERSPROFILE%\Documents\My Videos
; 16415 %ALLUSERSPROFILE%\Favorites
; 16406 %ALLUSERSPROFILE%\Start Menu
; 16407 %ALLUSERSPROFILE%\Start Menu\Programs
; 16431 %ALLUSERSPROFILE%\Start Menu\Programs\Administrative Tools
; 16408 %ALLUSERSPROFILE%\Start Menu\Programs\Startup
; 16429 %ALLUSERSPROFILE%\Templates
; 16410 %USERPROFILE%\Application Data
; 16417 %USERPROFILE%\Cookies
; 16384 %USERPROFILE%\Desktop
; 16400 %USERPROFILE%\Desktop
; 16390 %USERPROFILE%\Favorites
; 16412 %USERPROFILE%\Local Settings\Application Data
; 16443 %USERPROFILE%\Local Settings\Application Data\Microsoft\CD Burning
; 16418 %USERPROFILE%\Local Settings\History
; 16416 %USERPROFILE%\Local Settings\Temporary Internet Files
; 16389 %USERPROFILE%\My Documents
; 16397 %USERPROFILE%\My Documents\My Music
; 16423 %USERPROFILE%\My Documents\My Pictures
; 16398 %USERPROFILE%\My Documents\My Videos
; 16403 %USERPROFILE%\NetHood
; 16411 %USERPROFILE%\PrintHood
; 16392 %USERPROFILE%\Recent
; 16393 %USERPROFILE%\SendTo
; 16395 %USERPROFILE%\Start Menu
; 16386 %USERPROFILE%\Start Menu\Programs
; 16432 %USERPROFILE%\Start Menu\Programs\Administrative Tools
; 16391 %USERPROFILE%\Start Menu\Programs\Startup
; 16405 %USERPROFILE%\Templates
; 16422 %ProgramFiles%
; 16427 %ProgramFiles%\Common Files
; 16440 %SystemRoot%\Resources
; 16441 %SystemRoot%\Resources\0409
;
; e.g.
; For shortcut in users Quick Launch toolbar,
; "%16410%\Microsoft\Internet Explorer\Quick Launch\"

You can remove all the commented lines to make it smaller

In my example the standalone programs,(all freeware), were each within their own folders within a folder called Standalone which in turn resided inside \$OEM$\$Progs and the shortcuts were all created within their own new folders within a new folder named Standalone which in turn resided in %USERPROFILE%\Start Menu\Programs.

Hope this has been of some use to you!

Link to comment
Share on other sites


I just use shortcut.exe to make my shortcuts during application installs.

http://optimumx.com/download/

Shortcut [Version 1.10]

Creates, modifies or queries Windows shell links (shortcuts)


The syntax of this command is:

shortcut /F:filename /A:C|E|Q [/T:target] [/P:parameters] [/W:workingdir]
        [/R:runstyle] [/I:icon,index] [/H:hotkey] [/D:description]

/F:filename    : Specifies the .LNK or .URL shortcut file.
/A:action      : Defines the action to take (C=Create, E=Edit or Q=Query).
/T:target      : Defines the target path and file name the shortcut points to.
/P:parameters  : Defines the command-line parameters to pass to the target.
/W:working dir : Defines the working directory the target starts with.
/R:run style   : Defines the window state (1=Normal, 3=Max, 7=Min).
/I:icon,index  : Defines the icon and optional index (file.exe or file.exe,0).
/H:hotkey      : Defines the hotkey, a numeric value of the keyboard shortcut.
/D:description : Defines the description (or comment) for the shortcut.

Notes:
- Any argument that contains spaces must be enclosed in "double quotes".
- If Query is specified (/A:Q), all arguments except /F: are ignored.
- To find the numeric hotkey value, use Explorer to set a hotkey and then /A:Q
- To prevent an environment variable from being expanded until the shortcut
  is launched, use the ^ carat escape character like this: ^%WINDIR^%

Examples:
  /f:"%ALLUSERSPROFILE%\Start Menu\Programs\My App.lnk" /a:q
  /f:"%USERPROFILE%\Desktop\Notepad.lnk" /a:c /t:^%WINDIR^%\Notepad.exe /h:846
  /f:"%USERPROFILE%\Desktop\Notepad.lnk" /a:e /p:C:\Setup.log /r:3

An argument of /? or -? displays this syntax and returns 1.
A successful completion will return 0.


Copyright 2000-2003 Marty List, www.OptimumX.com

Link to comment
Share on other sites

Agreed, shortcut.exe works fine, I just wanted a method of doing it without adding stuff I would never use again (i.e. shortcut.exe).

I haven't exactly done it this way myself since I use a runonceex.inf file and run it from there.

Link to comment
Share on other sites

I'm trying your method.

But can i use all the option of Shorcuts?

I'm trying this:

[Version]
Signature=$CHICAGO$

[Shortcuts]
UpdateInis=AddLink

[AddLink]
;--- adds shortcut to "daisy.exe -m" within %ProgramFiles%\Daisy_v2.2\bin folder
;--- to %USERPROFILE%\Start Menu\Programs\
setup.ini, progman.groups,, ""group1="%16386%"""
setup.ini, group1,,"""Daisy Windows Update"",""""""%16422%\Daisy_v2.2\bin\daisy.exe -m"""""""

maybe this one is right form?

[Version]
Signature=$CHICAGO$

[Shortcuts]
UpdateInis=AddLink

[AddLink]
;--- adds shortcut to "daisy.exe -m" within %ProgramFiles%\Daisy_v2.2\bin folder
;--- to %USERPROFILE%\Start Menu\Programs\
setup.ini, progman.groups,, ""group1="%16386%"""
setup.ini, group1,,"""Daisy Windows Update"",""""""%16422%\Daisy_v2.2\bin\daisy.exe" -m""""""

thank you

mrmr

Link to comment
Share on other sites

I use shortcut... in a batch file.

@echo off

rem set t= FULL PATH TO EXE
rem set n= FULL PATH TO LOCATIOON OF SHORTCUT
rem set d= WORKING DIRECTORY OF SHORTCUT
rem set a= ARGUMENTS OF SHORTCUT
rem set i= ICONFILE
rem set X= ICONINDEX
rem start /wait shortcut.exe -t %t% -n %n% -d %d% -a %a% -i %i% -X %x% -f

set t="%ProgramFiles%\netmeeting\conf.exe"
set n="%ALLUSERSPROFILE%\Start Menu\Programs\Accessories\Communications\Netmeeting.lnk"
set d="%ProgramFiles%\netmeeting"
start /wait shortcut.exe -t %t% -n %n% -d %d% -f

set t="%Windir%\System32\VCdControlTool.exe"
set n="%ALLUSERSPROFILE%\Start Menu\Programs\Accessories\System Tools\Virtual CD Control.lnk"
set d="%USERPROFILE%\Documents"
start /wait shortcut.exe -t %t% -n %n% -d %d% -f


set t= "%Windir%\bginfo.exe"
set n= "%USERPROFILE%\Start Menu\Programs\StartUp\BGInfo.lnk"
set d= "%Windir%"
set a= "%Windir%\bginfo.bgi /timer:0"
start /wait shortcut.exe -t %t% -n %n% -d %d% -a %a% -f

Link to comment
Share on other sites

re...i've tried your method

REG ADD %KEY%\105 /VE /D "Adding user defined shortcuts" /f
REG ADD %KEY%\105 /V 1 /D "rundll32 setupapi,InstallHinfSection Shortcuts 128 %systemdrive%\install\Inf\shortcuts.inf" /f

and here shortcuts.inf

[Version]
Signature=$CHICAGO$

[Shortcuts]
UpdateInis=AddLink

[AddLink]
;---
;--- adds shortcut to Daisy.exe within %ProgramFiles%\Daisy_v2.2\bin folder
;--- to %USERPROFILE%\Start Menu\Programs
;---
setup.ini, progman.groups,, ""group1="%16386%"""
setup.ini, group1,,"""Daisy Windows Update"",""""""%16422%\Daisy_v2.2\bin\daisy.exe -m"""""""
;---
;--- adds shortcut to Regmon.exe within %ProgramFiles%\ntRegmon\ folder
;--- to %USERPROFILE%\Start Menu\Programs
;---
setup.ini, progman.groups,, ""group2="%16386%"""
setup.ini, group2,,"""RegMon"",""""""%16422%\ntRegmon\Regmon.exe"""""""
;---
;--- adds shortcut to Regmon.exe within %ProgramFiles%\ntRegmon folder
;--- to %USERPROFILE%\Desktop
;---
setup.ini, progman.groups,, ""group3="%16400%"""
setup.ini, group3,,"""Regmon"",""""""%16422%\ntRegmon\Regmon.exe"""""""

btw, in RunOnceEx windows...appears a generic error...

Error

Installation Failed

Where i'm wrong?

mrmr

Link to comment
Share on other sites

a ? i would like to Add All the Shortcuts from desktop to the quick Launch some one tell me how to do it i don't know any thing about add shortcuts i'm still new at this? and i plan on deleteing the shortcuts on the desktop.

Link to comment
Share on other sites

a ? i would like to Add All the Shortcuts from desktop to the quick Launch some one tell me how to do it i don't know any thing about add shortcuts i'm still new at this? and i plan on deleteing the shortcuts on the desktop.

Search. :)

Link to comment
Share on other sites

  • 6 months later...

[version]
signature=$chicago$

[DefaultInstall]
UpdateInis=AddShortcut

[AddShortcut]
setup.ini, progman.groups,, ""group2="%24%"""
setup.ini, group2,,"""Readme"",""""""%24%\readme.txt"""""""

when i run this i get an error:

infsetupfailed.png

Windows 2000 SP4

what am i doing wrong?

Link to comment
Share on other sites

@ someuser77

First of all, it looks as if you have quotation marks in the wrong places.

Also where are you creating your shortcut? it appears as if you are placing one in %SystemDrive% called Readme to link to a readme.txt file also located in %SystemDrive%!

Here is a simple example along similar lines, to show you

[Version]
Signature  = $Windows NT$

[DefaultInstall]
UpdateInis = AddShortcut

[AddShortcut]
setup.ini, progman.groups,, "group2=""%16386%\ERUNT\"""
setup.ini, group2,,"Readme,""""""%16422%\ERUNT\README.TXT"""""""

This will place a shortcut in %USERPROFILE%\Start Menu\Programs\ERUNT called Readme to link to a readme.txt file located at %PROGRAMFILES%\ERUNT. Use the DIRIDs given in my original posting to try to help understand it.

Hope it helps!

Link to comment
Share on other sites

thank you for your relpy.

when i install your inf i get the same error as befor: Installatin Failed.

it appears as if you are placing one in %SystemDrive% called Readme to link to a readme.txt file also located in %SystemDrive%!
that is correct.
Link to comment
Share on other sites

Well I just tried to create a shortcut to readme.txt in ERUNT, no error message, but it didn't work. I suppose because there is little benefit to be had in creating a shortcut to something in the same location as the file it links to.

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...