?
Solved

script to copy microsoft office shortcuts to desktop

Posted on 2014-01-31
6
Medium Priority
?
2,248 Views
Last Modified: 2015-01-15
I'm looking for a script that will copy Microsoft office 2010 AND 2013 application shortcuts to users' desktops.

can any one help me find this? or help me create it?
for windows 7 pro computers running 64 bit.


similar to this (VBS file):
Const Office2003 = "C:\Program Files (x86)\Microsoft Office\Office11"
Const Office2010 = "C:\Program Files (x86)\Microsoft Office\Office14"

Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = WScript.CreateObject("WScript.Shell")

If fso.FolderExists(Office2010) Then
  officePath = Office2010
Else
  officePath = Office2003
End If

strDesktopFolder = objShell.SpecialFolders("Desktop")
Set objShortCut = objShell.CreateShortcut(strDesktopFolder & _
  "\Microsoft Word.lnk")
objShortCut.TargetPath = fso.BuildPath(officePath, "winword.exe")
objShortCut.Description = "Microsoft Word"
objShortCut.Save
0
Comment
Question by:Anthony H.
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 20

Expert Comment

by:ltlbearand3
ID: 39827147
I guess I don't really understand what you need.  You have all the logic you need in your script.  You just need to make some tweaks and put in a little extra code.  You will need to get the path for Office 2013.

For example just break out the two sections of code to copy each version of office.  Then you just need to copy and add the code for each MS office program that needs a shortcut.

Something like this:
Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = WScript.CreateObject("WScript.Shell")


' Office 2010
Const Office2010 = "C:\Program Files (x86)\Microsoft Office\Office14"

If fso.FolderExists(Office2010) Then
  officePath = Office2010

	strDesktopFolder = objShell.SpecialFolders("Desktop")

	' Create MS Word Shortcut
	Set objShortCut = objShell.CreateShortcut(strDesktopFolder & _
		"\Microsoft Word.lnk")
	objShortCut.TargetPath = fso.BuildPath(officePath, "winword.exe")
	objShortCut.Description = "Microsoft Word"
	objShortCut.Save 
	
	' Create MS Word Shortcut
	Set objShortCut = objShell.CreateShortcut(strDesktopFolder & _
		"\Microsoft Word.lnk")
	objShortCut.TargetPath = fso.BuildPath(officePath, "Excel.exe")
	objShortCut.Description = "Excel"
	objShortCut.Save 

	' And So ON for each product

End If


' Now just repeat the If statement code with values for Office 2013

Open in new window

0
 
LVL 32

Accepted Solution

by:
Robberbaron (robr) earned 2000 total points
ID: 39827280
this works for my system with 2007 installed.
dim fso, objShell
Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = WScript.CreateObject("WScript.Shell")


'MakeOff "2007" , "C:\Program Files (x86)\Microsoft Office\Office12"
MakeOff "2010" , "C:\Program Files (x86)\Microsoft Office\Office14"
MakeOff "2013" , "C:\Program Files (x86)\Microsoft Office\Office15" 

Wscript.quit

Sub MakeOff(officeYear , officePath )

	If fso.FolderExists(officePath ) Then

		strDesktopFolder = objShell.SpecialFolders("Desktop")

		' Create MS Word Shortcut
		Set objShortCut = objShell.CreateShortcut(strDesktopFolder & _
			"\Word" & officeYear & ".lnk")
		objShortCut.TargetPath = fso.BuildPath(officePath, "winword.exe")
		
		objShortCut.Description = "Word" & officeYear
		if fso.FileExists(objShortCut.TargetPath) then objShortCut.Save 
		
		' Create MS Word Shortcut
		Set objShortCut = objShell.CreateShortcut(strDesktopFolder & _
			"\Excel" & officeYear & ".lnk")
		objShortCut.TargetPath = fso.BuildPath(officePath, "Excel.exe")
		objShortCut.Description = "Excel" & officeYear
		if fso.FileExists(objShortCut.TargetPath) then objShortCut.Save 

		' Create Shortcut
		Set objShortCut = objShell.CreateShortcut(strDesktopFolder & _
			"\Powerpoint" & officeYear & ".lnk")
		objShortCut.TargetPath = fso.BuildPath(officePath, "POWERPNT.EXE")
		objShortCut.Description = "PowerPoint" & officeYear
		if fso.FileExists(objShortCut.TargetPath) then objShortCut.Save 

		' Create Shortcut
		Set objShortCut = objShell.CreateShortcut(strDesktopFolder & _
			"\Outlook" & officeYear & ".lnk")
		objShortCut.TargetPath = fso.BuildPath(officePath, "OutLook.EXE")
		objShortCut.Description = "Outlook" & officeYear
		if fso.FileExists(objShortCut.TargetPath) then objShortCut.Save 


	End If

end sub

Open in new window


save as vbs file
0
 

Author Comment

by:Anthony H.
ID: 39831453
Robberbaron,

this is great. it works!  Could you please add the option to copy to "taskbar" and "start menu"?

like when I right click on a program and gives me the option to "Pin to taskbar" and "Pin to Start Menu".
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 32

Expert Comment

by:Robberbaron (robr)
ID: 39831554
they are "extra-specialfolders" i believe.  And maybe Win7+ only.

the std specialfolders are from http://technet.microsoft.com/en-us/library/ee156616.aspx

the pinned startmenu items are actually stored in the user profile under Internet Explorer....
C:\Users\Robber\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu
C:\Users\Robber\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar

		strDesktopFolder = objShell.SpecialFolders("AppData")
		wscript.echo strDesktopFolder

Open in new window

points to roaming on vista+

so an update that should work (as i havent tested)
dim fso, objShell
Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = WScript.CreateObject("WScript.Shell")


'MakeOff "2007" , "C:\Program Files (x86)\Microsoft Office\Office12"
MakeOff "2010" , "C:\Program Files (x86)\Microsoft Office\Office14"
MakeOff "2013" , "C:\Program Files (x86)\Microsoft Office\Office15" 

Wscript.quit

Sub MakeOff(officeYear , officePath )

	If fso.FolderExists(officePath ) Then

		strDesktopFolder = objShell.SpecialFolders("Desktop")
    CreateAllLinks strDesktopFolder

    strStartPin = objShell.SpecialFolders("AppData") & "\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu"
    CreateAllLinks strStartPin
    
    strTaskPin = objShell.SpecialFolders("AppData") & "\Microsoft\Internet Explorer\Quick Launch\User Pinned\Taskbar"
    CreateAllLinks strTaskPin    
	End If

end sub

Sub CreateAllLinks(location)

		' Create MS Word Shortcut
		Set objShortCut = objShell.CreateShortcut(location & _
			"\Word" & officeYear & ".lnk")
		objShortCut.TargetPath = fso.BuildPath(officePath, "winword.exe")
		
		objShortCut.Description = "Word" & officeYear
		if fso.FileExists(objShortCut.TargetPath) then objShortCut.Save 
		
		' Create MS Word Shortcut
		Set objShortCut = objShell.CreateShortcut(location & _
			"\Excel" & officeYear & ".lnk")
		objShortCut.TargetPath = fso.BuildPath(officePath, "Excel.exe")
		objShortCut.Description = "Excel" & officeYear
		if fso.FileExists(objShortCut.TargetPath) then objShortCut.Save 

		' Create Shortcut
		Set objShortCut = objShell.CreateShortcut(location & _
			"\Powerpoint" & officeYear & ".lnk")
		objShortCut.TargetPath = fso.BuildPath(officePath, "POWERPNT.EXE")
		objShortCut.Description = "PowerPoint" & officeYear
		if fso.FileExists(objShortCut.TargetPath) then objShortCut.Save 

		' Create Shortcut
		Set objShortCut = objShell.CreateShortcut(location & _
			"\Outlook" & officeYear & ".lnk")
		objShortCut.TargetPath = fso.BuildPath(officePath, "OutLook.EXE")
		objShortCut.Description = "Outlook" & officeYear
		if fso.FileExists(objShortCut.TargetPath) then objShortCut.Save 

End SUb

Open in new window

0
 

Expert Comment

by:CPTholen
ID: 40552257
I have created shortcuts vbs files for 32 bit and 64 bit windows  and all different versions. Is it possible for someone smart to make it all into one .vbs file which only puts icons for the app and architecture they have?
Office-Shortcuts.zip
0
 

Author Comment

by:Anthony H.
ID: 40552639
wow you're awesome. that's pretty cool. it worked!!  It didn't work at first but I think that's because I have office365 subscription, but I changed the path to where the EXE's are and it worked flawlessly. beautiful! thanks!!!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Progress

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question