MSFN Forum: Best way to create shortcuts silently - MSFN Forum

Jump to content


Unattended CD/DVD Guide Homepage · MSFN Forum Rules

Welcome to the Applications Installs forum. Make sure you read the forum rules before you start posting.

Links/Requests to warez and/or any illegal material (porn, cracks, serials, etc..) will not be tolerated. Discussion of circumventing WGA/activation/timebombs/keygens or any other illegal activity will also not be tolerated.

We try our best to keep this forum clean of illegal content. If you see any illegal activity use the "report" button you find in every post to report the specific post to the moderators. If you ignore any of the rules you will be banned without notice.

Read Forum Rules
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Best way to create shortcuts silently Rate Topic: -----

#1 User is offline   jinkazama 

  • Member
  • PipPip
  • Group: Members
  • Posts: 196
  • Joined: 16-November 03
  • OS:Windows 8 x64
  • Country: Country Flag

Posted 14 February 2013 - 07:00 PM

Does anyone know how to create a desktop shortcut to an executable using a command line/batch or reg file?
I need it to solve desktop shortcuts for silent installer withous link creation switch like trojan remover.
Or for example, can i make a file to create shortcuts on desktop for word2003 and Excel 2003 after installing Office 2003 Word2007 and Excel 2007 after installing Office 2007?
Thank you

This post has been edited by jinkazama: 16 February 2013 - 02:22 AM



#2 User is offline   allen2 

  • Not really Newbie
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,736
  • Joined: 13-January 06

Posted 15 February 2013 - 12:41 AM

I usually use this for this kind of task.

#3 User is offline   jinkazama 

  • Member
  • PipPip
  • Group: Members
  • Posts: 196
  • Joined: 16-November 03
  • OS:Windows 8 x64
  • Country: Country Flag

Posted 15 February 2013 - 05:44 AM

Thank you allen2, i'll try shortcut 1.11, only a question, how can i create a link on all user desktop?

An example for skype:
shortcut.exe /F:"%allusersprofile%\Desktop\Testskype.lnk" /a:c /t:"%ProgramFiles(x86)%\Skype\Phone\Skype.exe"


How can i run it silently?

This post has been edited by jinkazama: 25 February 2013 - 04:42 PM


#4 User is offline   Tripredacus 

  • K-Mart-ian Legend
  • Group: Super Moderator
  • Posts: 8,670
  • Joined: 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Posted 15 February 2013 - 09:54 AM

Alternatively, here is how to do it using AutoIT:

FileCreateShortcut ( "c:\program files\folder\file.exe" , "c:\users\public\desktop\File Name.lnk" , "c:\program files\workingdir" , "" , "Description" , "c:\program files\folder\iconfile.ico" )


#5 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,433
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 15 February 2013 - 12:04 PM

Or get nircmd:
http://www.nirsoft.n...ils/nircmd.html

Which is also useful for a ton other tasks.

Which OS?
If Vista :ph34r: or 7, check this also:
http://www.techrepub...-windows-7/1857

jaclaz

#6 User is offline   radix 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 732
  • Joined: 08-February 07
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 15 February 2013 - 04:38 PM

You should use inf method or AutoIt, because these methods use dir id's (inf) or macros for folders (AutoIt), for example @DesktopCommonDir instead of C:\Users\Public\Desktop

AutoIt method (on the top of .au3 file, you can add command to install Office 2003 silently):
FileCreateShortcut(@ProgramFilesDir & "\Microsoft Office\Office11\WINWORD.EXE", @DesktopCommonDir & "\Word 2003.lnk", @ProgramFilesDir & "\Microsoft Office\Office11", "", "Create beautiful documents, easily work with others, and enjoy the read.")
FileCreateShortcut(@ProgramFilesDir & "\Microsoft Office\Office11\EXCEL.EXE", @DesktopCommonDir & "\Excel 2003.lnk", @ProgramFilesDir & "\Microsoft Office\Office11", "", "Easily discover, visualize, and share insights from your data.")


Inf method:
Use 3 files: install.cmd, create_shortcut_x86.inf and create_shortcut_x64.inf
install.cmd content (on the top of install.cmd file, you can add command to install Office 2003 silently):
@ECHO OFF
:: Check the operating system type (32 bit or 64 bit)
IF NOT EXIST  %SystemRoot%\SysWOW64 GOTO X86
IF EXIST  %SystemRoot%\SysWOW64 GOTO X64
:: 32 bit
:X86
::Create All Users Desktop icons for Word 2003 and Excel 2003 on 32 bit operating systems
start rundll32.exe advpack.dll,LaunchINFSection create_shortcut_x86.inf,,1
:: 64 bit
:X64
::Create All Users Desktop icons for Word 2003 and Excel 2003 on 64 bit operating systems
start rundll32.exe advpack.dll,LaunchINFSection create_shortcut_x64.inf,,1
:END
EXIT


create_shortcut_x86.inf content:
[Version]
Signature=$Windows NT$

[DefaultInstall]
ProfileItems=1IconItemAdd
ProfileItems=2IconItemAdd

[1IconItemAdd]
; All Users Desktop icon for MSO Word 2003
Name = "Word 2003", 0x0000008, 16409
CmdLine = 16422,"Microsoft Office\Office11","WINWORD.EXE"
WorkingDir = 16422,"Microsoft Office\Office11"
InfoTip = "Create beautiful documents, easily work with others, and enjoy the read."

[2IconItemAdd]
; All Users Desktop icon for MSO Excel 2003
Name = "Excel 2003", 0x0000008, 16409
CmdLine = 16422,"Microsoft Office\Office11","EXCEL.EXE"
WorkingDir = 16422,"Microsoft Office\Office11"
InfoTip = "Easily discover, visualize, and share insights from your data."


create_shortcut_x64.inf content:
[Version]
Signature=$Windows NT$

[DefaultInstall]
ProfileItems=1IconItemAdd
ProfileItems=2IconItemAdd

[1IconItemAdd]
; All Users Desktop icon for MSO Word 2003
Name = "Word 2003", 0x0000008, 16409
CmdLine = 16426,"Microsoft Office\Office11","WINWORD.EXE"
WorkingDir = 16426,"Microsoft Office\Office11"
InfoTip = "Create beautiful documents, easily work with others, and enjoy the read."

[2IconItemAdd]
; All Users Desktop icon for MSO Excel 2003
Name = "Excel 2003", 0x0000008, 16409
CmdLine = 16426,"Microsoft Office\Office11","EXCEL.EXE"
WorkingDir = 16426,"Microsoft Office\Office11"
InfoTip = "Easily discover, visualize, and share insights from your data."


More info regarding shortcut creation using inf here

This post has been edited by radix: 16 February 2013 - 09:53 AM


#7 User is offline   jinkazama 

  • Member
  • PipPip
  • Group: Members
  • Posts: 196
  • Joined: 16-November 03
  • OS:Windows 8 x64
  • Country: Country Flag

Posted 15 February 2013 - 04:51 PM

I need it for all OS, Windows XP, Vista, 7 and 8

#8 User is offline   jinkazama 

  • Member
  • PipPip
  • Group: Members
  • Posts: 196
  • Joined: 16-November 03
  • OS:Windows 8 x64
  • Country: Country Flag

Posted 24 February 2013 - 04:51 PM

@radix
i've create same script for Word and Excel 2007 but it doesn't work
Can you check it for me?
Thank you

install.cmd
@ECHO OFF
:: Check the operating system type (32 bit or 64 bit)
IF NOT EXIST  %SystemRoot%\SysWOW64 GOTO X86
IF EXIST  %SystemRoot%\SysWOW64 GOTO X64
:: 32 bit
:X86
::Create All Users Desktop icons for Word 2007 and Excel 2007 on 32 bit operating systems
start rundll32.exe advpack.dll,LaunchINFSection create_shortcut_x86.inf,,1
:: 64 bit
:X64
::Create All Users Desktop icons for Word 2007 and Excel 2007 on 64 bit operating systems
start rundll32.exe advpack.dll,LaunchINFSection create_shortcut_x64.inf,,1
:END
EXIT



create_shortcut_x86.inf
[Version]
Signature=$Windows NT$

[DefaultInstall]
ProfileItems=1IconItemAdd
ProfileItems=2IconItemAdd

[1IconItemAdd]
; All Users Desktop icon for MSO Word 2007
Name = "Microsoft Office Word 2007", 0x0000008, 16409
CmdLine = 16422,"Microsoft Office\Office12","WINWORD.EXE"
WorkingDir = 16422,"Microsoft Office\Office12"
InfoTip = "Create beautiful documents, easily work with others, and enjoy the read."

[2IconItemAdd]
; All Users Desktop icon for MSO Excel 2007
Name = "Microsoft Office Excel 2007", 0x0000008, 16409
CmdLine = 16422,"Microsoft Office\Office12","EXCEL.EXE"
WorkingDir = 16422,"Microsoft Office\Office12"
InfoTip = "Easily discover, visualize, and share insights from your data."



create_shortcut_x64.inf
[Version]
Signature=$Windows NT$

[DefaultInstall]
ProfileItems=1IconItemAdd
ProfileItems=2IconItemAdd

[1IconItemAdd]
; All Users Desktop icon for MSO Word 2007
Name = "Microsoft Office Word 2007", 0x0000008, 16409
CmdLine = 16426,"Microsoft Office\Office12","WINWORD.EXE"
WorkingDir = 16426,"Microsoft Office\Office12"
InfoTip = "Create beautiful documents, easily work with others, and enjoy the read."

[2IconItemAdd]
; All Users Desktop icon for MSO Excel 2007
Name = "Microsoft Office Excel 2007", 0x0000008, 16409
CmdLine = 16426,"Microsoft Office\Office12","EXCEL.EXE"
WorkingDir = 16426,"Microsoft Office\Office12"
InfoTip = "Easily discover, visualize, and share insights from your data."



#9 User is offline   Geej 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 634
  • Joined: 01-January 08
  • OS:XP Pro x86
  • Country: Country Flag

Posted 24 February 2013 - 06:44 PM

Here is my MSOfficeSc.inf for Word & excel 2007 (works for x86 & x64 within 1 inf)
Command line usage is at the end of inf


; Word & Excel 2007 Shortcut on all users desktop

[Version]
Signature=$Windows NT$

[DefaultInstall]
RegisterDLLs=Start.Register

[Start.Register]
11,,rundll32.exe,,,"advpack.dll,LaunchINFSection %1%\%infname%.inf,Install"

[Install.ntx86]
ProfileItems=WordSC, ExcelSC

[Install.ntamd64]
ProfileItems=WordSC64, ExcelSC64

[WordSC]
Name =Word 2007,0x8,25
CmdLine = 16422,Microsoft Office\Office12,WINWORD.EXE
WorkingDir = 16422,Microsoft Office\Office12
InfoTip ="Create and edit professional-looking documents such as letters, papers, reports, and booklets by using Microsoft Office Word."

[ExcelSC]
Name = Excel 2007,0x8,25
CmdLine = 16422,Microsoft Office\Office12,EXCEL.EXE
WorkingDir = 16422,Microsoft Office\Office12
InfoTip = "Perform calculations, analyze information, and visualize data in spreadsheets by using Microsoft Office Excel."

[WordSC64]
Name =Word 2007,0x8,25
CmdLine = 16426,Microsoft Office\Office12,WINWORD.EXE
WorkingDir = 16426,Microsoft Office\Office12
InfoTip ="Create and edit professional-looking documents such as letters, papers, reports, and booklets by using Microsoft Office Word."

[ExcelSC64]
Name = Excel 2007,0x8,25
CmdLine = 16426,Microsoft Office\Office12,EXCEL.EXE
WorkingDir = 16426,Microsoft Office\Office12
InfoTip = "Perform calculations, analyze information, and visualize data in spreadsheets by using Microsoft Office Excel."

[Strings]
Infname=MSOfficeSc

[commandline]
rundll32.exe advpack.dll,LaunchINFSection MSOfficeSc.inf,install


This post has been edited by Geej: 24 February 2013 - 06:46 PM


#10 User is offline   Geej 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 634
  • Joined: 01-January 08
  • OS:XP Pro x86
  • Country: Country Flag

Posted 25 February 2013 - 07:12 PM

Come to think of it, I think the best way to create shortcut silently is to use OCT 2007 (office customization tool), if you are using it.
It allows to create desktop shortcut. Better than any script, IMHO. During uninstall, at least it is able to remove it.
For reference, scroll (3/4 down the page) to 'Add/Modify Shortcut Entry dialog box' -> 'Location' for various shortcut location.

Best regards

#11 User is online   DosProbie 

  • Member
  • Group: Supreme Sponsor
  • Posts: 202
  • Joined: 16-October 12
  • OS:Windows 8 x64
  • Country: Country Flag

Posted 25 February 2013 - 10:41 PM

View Postjinkazama, on 14 February 2013 - 07:00 PM, said:

Does anyone know how to create a desktop shortcut to an executable using a command line/batch or reg file?
I need it to solve desktop shortcuts for silent installer withous link creation switch like trojan remover.
Or for example, can i make a file to create shortcuts on desktop for word2003 and Excel 2003 after installing Office 2003 Word2007 and Excel 2007 after installing Office 2007?
Thank you




When I do my O2K7 Install and now O2K10 rather than have shortcuts to the desktop I have then auto install to the taskbar for a cleaner look.. from a reg file and vbs file..

#12 User is offline   radix 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 732
  • Joined: 08-February 07
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 03 March 2013 - 06:05 AM

@jinkazama
Your samples from the post #8 will not work, because you have installed a 64 bit version of Office 2007 under a 64 bit version of Windows. In this case change 16426 with 16422 in create_shortcut_x64.inf and make sure that you always install Office 2007 x64 or laterunder a 64 bit OS.

@Geej
Your script will not work with Office 2007 x64 or later under 64 bit Windows due to the same reason explained above.

Edit: jinkazama, if you want to use a simpler method (a single AutoIt script for all install process and shortcut creation), I can post one.

This post has been edited by radix: 03 March 2013 - 06:07 AM


#13 User is online   DosProbie 

  • Member
  • Group: Supreme Sponsor
  • Posts: 202
  • Joined: 16-October 12
  • OS:Windows 8 x64
  • Country: Country Flag

Posted 03 March 2013 - 09:24 AM

View Postjinkazama, on 14 February 2013 - 07:00 PM, said:

Does anyone know how to create a desktop shortcut to an executable using a command line/batch or reg file?
I need it to solve desktop shortcuts for silent installer withous link creation switch like trojan remover.
Or for example, can i make a file to create shortcuts on desktop for word2003 and Excel 2003 after installing Office 2003 Word2007 and Excel 2007 after installing Office 2007?
Thank you


Jinkazama,
This is a .vbs script that I use when doing silent install, I set the path normally to the Taskbar (Don't like my desktop cluttered with shortcuts)
but I adjusted this to the desktop for you... I run it from my FinalRun.cmd batch file with the following command:
cscript //nologo "%~dp0AddShortcuts.vbs" or you can try "%~dp0AddShortcuts.vbs"
DosProbie.. Posted Image
[code' Auto Adds Shortcut's to Desktop
' AddShortcuts.vbs - DosProbie.2013
' Pin Shortcuts To Desktop - Win7 or Win8 64-bit
' Note: Revise the first line "objShortCut = Shell" PATH FOR SHORTCUT AS NEEDED!
' Revised: 03.03.13

Dim Act,colEnvironmentVariables, objShortCut, Shell
Set Shell = CreateObject("WScript.Shell")
Set colEnvironmentVariables = Shell.Environment("Volatile")
Set Act = CreateObject("Wscript.Shell")

'Excel 2007
Set objShortCut = Shell.CreateShortcut(Act.ExpandEnvironmentStrings("%userprofile%\desktop\Microsoft Office Excel 2007.lnk"))
objShortCut.TargetPath = Act.ExpandEnvironmentStrings("%programfiles(x86)%\Microsoft Office\Office12\Excel.exe")
objShortCut.Arguments = " /prefetch:1"
objShortCut.Description = "Essential software suite for home computer users with Office 2007."
objShortCut.Save

'Word 2007
Set objShortCut = Shell.CreateShortcut(Act.ExpandEnvironmentStrings("%userprofile%\desktop\Microsoft Office Word 2007.lnk"))
objShortCut.TargetPath = Act.ExpandEnvironmentStrings("%programfiles(x86)%\Microsoft Office\Office12\WINWORD.EXE")
objShortCut.Arguments = " /prefetch:1"
objShortCut.Description = "Essential software suite for home computer users with Office 2007."
objShortCut.Save

'WMP 12.0
'Set objShortCut = Shell.CreateShortcut(Act.ExpandEnvironmentStrings("%userprofile%\desktop\windows media player.lnk"))
'objShortCut.TargetPath = Act.ExpandEnvironmentStrings("%programfiles(x86)%\windows media player\wmplayer.exe")
'objShortCut.Arguments = " /prefetch:1"
'objShortCut.Description = "Play digital media including music, videos, CDs, and DVDs."
'objShortCut.Save
][/code]



#14 User is offline   jinkazama 

  • Member
  • PipPip
  • Group: Members
  • Posts: 196
  • Joined: 16-November 03
  • OS:Windows 8 x64
  • Country: Country Flag

Posted 03 March 2013 - 05:36 PM

View Postradix, on 03 March 2013 - 06:05 AM, said:

@jinkazama
Your samples from the post #8 will not work, because you have installed a 64 bit version of Office 2007 under a 64 bit version of Windows. In this case change 16426 with 16422 in create_shortcut_x64.inf and make sure that you always install Office 2007 x64 or laterunder a 64 bit OS.

@Geej
Your script will not work with Office 2007 x64 or later under 64 bit Windows due to the same reason explained above.

Edit: jinkazama, if you want to use a simpler method (a single AutoIt script for all install process and shortcut creation), I can post one.

radix, i have office 2007 32bit installed on Windows x64

#15 User is offline   Geej 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 634
  • Joined: 01-January 08
  • OS:XP Pro x86
  • Country: Country Flag

Posted 03 March 2013 - 06:30 PM

Hi jinkazama
Does my inf works for you?
What have you tried so far? If doesn't work for you, can you provide more detail...

Cheers

#16 User is offline   jinkazama 

  • Member
  • PipPip
  • Group: Members
  • Posts: 196
  • Joined: 16-November 03
  • OS:Windows 8 x64
  • Country: Country Flag

Posted 04 March 2013 - 08:55 AM

hi Geej, i'm trying all posted methods, i'll feedback about tests :)

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy