Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

Custom Shortcuts in INF Files

- - - - -

  • Please log in to reply
17 replies to this topic

#1
glitterglue

glitterglue

    Newbie

  • Member
  • 14 posts
  • Joined 29-March 04
  • OS:Windows 7 x64
  • Country: Country Flag
Got a weird one here.

I'm attempting to use an inf file to create some custom shortcuts.

Here's part of what I've got in my "shortcut.inf" file:

----------------------------------------
[Version]
Signature=$CHICAGO$

[AddShortcuts]
ProfileItems=WindowsExplorerAdd, InfoAdd

[WindowsExplorerAdd] <---This section works great! Thanks Gosh!
Name = "Windows Explorer"
CmdLine = 10,,explorer.exe
IconPath = 10,,explorer.exe
IconIndex = 1
InfoTip = "@%11%\shell32.dll,-22579"
DisplayResource = "%11%\shell32.dll",22067

[InfoAdd] <---This section blows.. :) ??
Name = "System Information"
CmdLine = 10,,Info.exe
WorkingDir = 10
IconPath = 10,,Info.exe
IconIndex = 1
InfoTip = "Displays System Resource Information"
----------------------------------------

I'm "testing" using the command: "rundll32 setupapi,InstallHinfSection AddShortCuts 128 .\Shortcuts.inf"

So, why does this create another .lnk file called "Windows Explorer" in my "All Users\Start Menu\Program" directory and not a "System Information" icon??

Thx


How to remove advertisement from MSFN

#2
glitterglue

glitterglue

    Newbie

  • Member
  • 14 posts
  • Joined 29-March 04
  • OS:Windows 7 x64
  • Country: Country Flag
So, does anyone (besides Gosh) know enough about .inf files to answer the question .. .. ??

#3
enuffsaid

enuffsaid

    Friend of MSFN

  • Member
  • PipPipPipPipPip
  • 866 posts
  • Joined 26-December 03
You don't want Gosh to answer? :)

#4
GreenMachine

GreenMachine

    ineXPlicable

  • Developer
  • 3,062 posts
  • Joined 22-August 03
That code works fine in my tests. Perhaps you have a minor syntax error that is stopping the .INF file? Try reversing the order of the *Add sections, or something. The problem is not in the code ... Try mine ...

Attached Files



#5
glitterglue

glitterglue

    Newbie

  • Member
  • 14 posts
  • Joined 29-March 04
  • OS:Windows 7 x64
  • Country: Country Flag
enuffsaid - If Gosh answered, that'd be great. :rolleyes: I know that he's busy & I just didn't want to wait for his answer alone.

GreenMachine - Hmm.. Your approach does indeed work - go figure.. The only difference between your way and mine is that I was "testing" from a command prompt - same test command, just a different method.

I think I'll use the .cmd file approach from now on as that is more efficient. :)

Thanks a bunch.

#6
fczajka

fczajka
  • Member
  • 6 posts
  • Joined 26-May 04
If I wanted to create the shortcut on the desktop instead of the start menu what would be the syntax?

//FC

#7
gosh

gosh

    gosh 2.0

  • Patrons
  • 2,347 posts
  • Joined 03-October 03
  • OS:none specified
  • Country: Country Flag
Profileitems only makes start menu shortcuts.

A ProfileItems directive is used in an INF DDInstall section to list one or more profile-items-sections that contain items or groups to be added to, or removed from, the Start menu.


-gosh

#8
DarkShadows

DarkShadows

    The brighter the light, the darker the shadows.

  • Member
  • PipPip
  • 272 posts
  • Joined 12-January 05
:realmad: Arrrrrgggggggggggggh! Whew, that felt good!

I'm having exactly the same issue as the first post in this thread, and it is baffling me.

This is my shortcut.inf file:

[Version]
Signature=$Windows NT$
Provider=%INF-Creator%

[DefaultInstall]
ProfileItems = DOpusExe, DOpusHelp

[DOpusExe]
Name = %DOpusExeDescription%
CmdLine = 16422,%DOpusExeFolder%, %DOpusExe%
SubDir = %DOpusGroup%
InfoTip = %DOpusExeTip%

[DOpusHelp]
Name = %DOpusHelpDescription%
CmdLine = 16422,%DOpusHelpFolder%, %DOpusHelp%
SubDir = %DOpusGroup%
InfoTip = %DOpusHelpTip%

[Strings]
INF-Creator = "DarkShadows"
DOpusGroup = "TEST-File Management\Directory Opus"
DOpusExe = "dopus.exe"
DOpusExeDescription = "Directory Opus"
DOpusExeFolder = "GPSoftware\Directory Opus"
DOpusExeTip = "The ultimate Windows Explorer replacement, and a while lot more!"
DOpusHelp = "dopus.hlp"
DOpusHelpDescription = "Directory Opus"
DOpusHelpFolder = "GPSoftware\Directory Opus\Help"
DOpusHelpTip = "Contains most syntax-related information."

What happens is that only the DOpusHelp shortcut gets created. But here's what's even more weird: if I comment out the DOpusHelp section entirely, then the DOpusExe works fine. It's as if I can only create one shortcut per .inf file?

I have already tried moving the DOpusHelp section before the DOpusExe section—same results.

Can anybody see what I might have done wrong here?

I should add that I am merely testing this file by right-clicking it and selecting Install from the context menu in Windows Explorer.

Edited by DarkShadows, 10 May 2006 - 01:36 AM.

I'm still looking for that damned <Any> key!
Check Out My: Sysinternals Installer Builder | GUIDE: Download Everything Microsoft

#9
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,537 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

This one's a beauty, you're going to kick yourself…

In the strings section, you've got:
DOpusExeDescription  = "Directory Opus"
DOpusHelpDescription = "Directory Opus"
What is happening is that you are creating an exe shortcut with the name Directory Opus, then creating a hlp shortcut with exactly the same name; thus overwriting the first with the second!

#10
DarkShadows

DarkShadows

    The brighter the light, the darker the shadows.

  • Member
  • PipPip
  • 272 posts
  • Joined 12-January 05

This one's a beauty, you're going to kick yourself…

In the strings section, you've got:

DOpusExeDescription  = "Directory Opus"
DOpusHelpDescription = "Directory Opus"
What is happening is that you are creating an exe shortcut with the name Directory Opus, then creating a hlp shortcut with exactly the same name; thus overwriting the first with the second!


Yeah Yeah. This is my brain... and this my brain on next to no sleep :wacko:

Thanks Yzöwl!
I'm still looking for that damned <Any> key!
Check Out My: Sysinternals Installer Builder | GUIDE: Download Everything Microsoft

#11
ZileXa

ZileXa

    Friend of MSFN

  • Member
  • PipPipPipPipPip
  • 767 posts
  • Joined 27-May 04
for an installer, am using ProfileItems as well to create Shortcuts, but I want my .INF to have an Uninstall section as well. The INF file is only used to create shortcuts.
(its for a very easy installer that only need to do few things, the most efficient way for this is to use a batchfile. But I create the shortcuts with an INF file since there is no nice way to do it with batchfiles (The shortcuts must be created correctly for every Windows language, also Greek and French etc. Start menu\programs uses strange accents and stuff for these and other languages.. thats why INF is very handy for this.)

But when uninstalling, these shortcuts need to be removed.... can't find any documentation about this :(


;This file will create the Shortcuts

[Version]
Signature = $Windows NT$

;----------------------------------------------------------
;INSTALL SHORTCUTS
;----------------------------------------------------------

[DefaultInstall]
ProfileItems = Shortcut.guide, Shortcut.rebuild

[Shortcut.guide]
Name = "Guide"
SubDir= mysubfolder
WorkingDir = 16422
CmdLine = 16422,"mysubfolder","Guide.pdf"

[Shortcut.rebuild]
Name = "rebuild"
SubDir= mysubfolder
WorkingDir = 16422
CmdLine = 16422,"mysubfolder", Rebuild.exe
InfoTip = "blahblah"


[DefaultUninstall] <-- this part doesn't work like this...
Profileitems = del.subfolder
[del.subfolder]
Name = mysubfolder,0x00000004

Edited by ZileXa, 30 May 2006 - 05:23 PM.


#12
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,537 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

Try
 
[Version]
Signature = $Windows NT$

[DefaultInstall]
ProfileItems = SMGroup.Add, Shortcut.guide, Shortcut.rebuild

[DefaultUninstall]
ProfileItems = SMGroup.Del

[SMGroup.Add]
Name = mysubfolder, 0x4

[Shortcut.guide]
Name = Guide
SubDir = mysubfolder
WorkingDir = 16422
CmdLine = 16422,mysubfolder,Guide.pdf

[Shortcut.rebuild]
Name = rebuild
SubDir = mysubfolder
WorkingDir = 16422
CmdLine = 16422,mysubfolder, Rebuild.exe
InfoTip = "blahblah"

[SMGroup.Del]
Name = mysubfolder, 0x6
Updated due to stupid, 'lack of sleep', error.

Edited by Yzöwl, 31 May 2006 - 07:16 AM.


#13
ZileXa

ZileXa

    Friend of MSFN

  • Member
  • PipPipPipPipPip
  • 767 posts
  • Joined 27-May 04
thanks!
Name = mysubfolder, 0x6
works!
Now I only have one more problem left..

#14
DarkShadows

DarkShadows

    The brighter the light, the darker the shadows.

  • Member
  • PipPip
  • 272 posts
  • Joined 12-January 05
Q: Does anyone know how to create a shortcut.inf, where the target file has spaces in its file name?

Here's the Shortcut.inf:
[Version]
Signature=$Windows NT$
Provider=%INF-Creator%

[DefaultInstall]
ProfileItems = UL_PI_11_PDF.Shortcut,UL_GA_5_PDF.Shortcut,UL_Album_11_PDF.Shortcut

[UL_PI_11_PDF.Shortcut]
Name = %UL_PI_11_Name%
CmdLine = 16422,"%UL_PI_Man_Dir%","%UL_PI_11_PDF%"
SubDir = "%UL_PI_Man_Grp%"
InfoTip = "%UL_PI_11_Tip%"

[UL_GA_5_PDF.Shortcut]
Name = %UL_GA_5_Name%
CmdLine = 16422,"%UL_PI_Man_Dir%","%UL_GA_5_PDF%"
SubDir = "%UL_PI_Man_Grp%"
InfoTip = "%UL_GA_5_Tip%"

[UL_Album_11_PDF.Shortcut]
Name = "%UL_Album_11_Name%"
CmdLine = 16422,"%UL_PI_Man_Dir%","%UL_Album_11_PDF%"
SubDir = "%UL_PI_Man_Grp%"
InfoTip = "%UL_Album_11_Tip%"

[Strings]
INF-Creator = "Kenneth R. Alcock"
UL_PI_Man_Dir = "Ulead Systems\Ulead PhotoImpact 11\Manual"
UL_PI_Man_Grp = "Digital Imaging\Ulead PhotoImpact 11\Manuals And Help"

UL_PI_11_PDF = "PI-11 MANUAL.pdf"
UL_PI_11_Name = "PhotoImpact 11 Manual"
UL_PI_11_Tip = "Ulead PhotoImpact 11 User Manual"

UL_GA_5_PDF = "GA-5 MANUAL.pdf"
UL_GA_5_Name = "GIF Animator 5 Manual"
UL_GA_5_Tip = "Ulead GIF Animator 5 User Manual"

UL_Album_11_PDF = "ALBUM-11.pdf"
UL_Album_11_Name = "Album 11 Manual"
UL_Album_11_Tip = "Ulead Album 11 User Manual"

Both of the .pdf files whose names contain spaces get messed up. For example, this is what happens to the target for the file named "PI-11 MANUAL.pdf":

"C:\Program Files\Ulead Systems\Ulead PhotoImpact 11\Manual\PI-11" MANUAL.pdf

Notice that Windows XP SP2 places the closing quote in the middle of the file name, before the space in the file name. By the way, I didn't name the files with spaces, they get installed that way.

Any help is appreciated!
I'm still looking for that damned <Any> key!
Check Out My: Sysinternals Installer Builder | GUIDE: Download Everything Microsoft

#15
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,537 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

Q: Does anyone know how to create a shortcut.inf, where the target file has spaces in its file name?

Yes!

Try this version as is...
[Version]Signature        = $Windows NT$Provider         = %INF-Creator%[DefaultInstall]ProfileItems     = UL_PI_11_PDF.Shortcut, UL_GA_5_PDF.Shortcut,\  UL_Album_11_PDF.Shortcut[UL_PI_11_PDF.Shortcut]Name             = %UL_PI_11_Name%CmdLine          = 16422, %UL_PI_Man_Dir%, %UL_PI_11_SFN%SubDir           = %UL_PI_Man_Grp%InfoTip          = "%UL_PI_11_Tip%"[UL_GA_5_PDF.Shortcut]Name             = %UL_GA_5_Name%CmdLine          = 16422, %UL_PI_Man_Dir%, %UL_GA_5_SFN%SubDir           = %UL_PI_Man_Grp%InfoTip          = "%UL_GA_5_Tip%"[UL_Album_11_PDF.Shortcut]Name             = %UL_Album_11_Name%CmdLine          = 16422, %UL_PI_Man_Dir%, %UL_Album_11_PDF%SubDir           = %UL_PI_Man_Grp%InfoTip          = "%UL_Album_11_Tip%"[Strings]INF-Creator      = "Kenneth R. Alcock"UL_Album_11_Name = "Album 11 Manual"UL_Album_11_PDF  = "ALBUM-11.pdf"UL_Album_11_Tip  = "Ulead Album 11 User Manual"UL_GA_5_Name     = "GIF Animator 5 Manual"UL_GA_5_PDF      = "GA-5 MANUAL.pdf"UL_GA_5_SFN      = "GA-5MA~1.pdf"UL_GA_5_Tip      = "Ulead GIF Animator 5 User Manual"UL_PI_11_Name    = "PhotoImpact 11 Manual"UL_PI_11_PDF     = "PI-11 MANUAL.pdf"UL_PI_11_SFN     = "PI-11M~1.pdf"UL_PI_11_Tip     = "Ulead PhotoImpact 11 User Manual"UL_PI_Man_Dir    = "Ulead Systems\Ulead PhotoImpact 11\Manual"UL_PI_Man_Grp    = "Digital Imaging\Ulead PhotoImpact 11\Manuals And Help"


#16
DarkShadows

DarkShadows

    The brighter the light, the darker the shadows.

  • Member
  • PipPip
  • 272 posts
  • Joined 12-January 05
Thanks Yzöwl! :thumbup

I thought about using short file names too. But I was wondering if there was a means to handle file names with spaces. I guess not. I tried sticking multiple quotes everywhere to no avail. It seems that .inf file conventions can not handle file names with spaces (though they do handle long file names without them).

Short names get tricky if one has a folder full of files with similarly named files.

On the plus side, the Windows XP shortcut ends up pointing to the long file name, even though the short name was specified.
I'm still looking for that damned <Any> key!
Check Out My: Sysinternals Installer Builder | GUIDE: Download Everything Microsoft

#17
DarkShadows

DarkShadows

    The brighter the light, the darker the shadows.

  • Member
  • PipPip
  • 272 posts
  • Joined 12-January 05
I just noticed that every Program Files group I've created with an .inf file is user-based, not under All Users.

Q: Using an .inf file, how can you create program groups/shortcuts under each of these?
  • All Users Profile
  • Default User's Profile
  • Current User's Profile
I know if the .inf is run at a certain point of Windows Setup, that Default User will be the current user, so groups and shortcuts will end up under each new user account created afterward. But I'm looking for an .inf file syntax answer here.

Thanks in advance for any ideas!

Edited by DarkShadows, 30 November 2006 - 10:09 AM.

I'm still looking for that damned <Any> key!
Check Out My: Sysinternals Installer Builder | GUIDE: Download Everything Microsoft

#18
mohammadgerami

mohammadgerami

    Newbie

  • Member
  • 20 posts
  • Joined 13-February 07
thanks for shortcut




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users