Solved

Install fonts with vbs

Posted on 2011-02-22
5
1,678 Views
Last Modified: 2012-06-27
Hello. I need to install new fonts on multiple Windows 7 machines. I found a blog that shows how to install one font using a vbs. Since I need to install multiple fonts, I modified the script.

My questions is were my modifications the best approach or is there a better way to do it?

Thank you for any information.

http://blogs.technet.com/b/rspitz/archive/2010/09/25/how-to-install-a-font-from-the-command-line-on-windows-7.aspx
UNIVCD47
UNIVCD67
Unvr57
Unvr58
Unvr67
Unvr68

Sub UNIVCD47
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\temp")
Set objFolderItem = objFolder.ParseName("UNIVCD47.ttf")
objFolderItem.InvokeVerb("Install")
End Sub

Sub UNIVCD67
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\temp")
Set objFolderItem = objFolder.ParseName("UNIVCD67.ttf")
objFolderItem.InvokeVerb("Install")
End Sub

Sub Unvr57
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\temp")
Set objFolderItem = objFolder.ParseName("Unvr57.ttf")
objFolderItem.InvokeVerb("Install")
End Sub

Sub Unvr58
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\temp")
Set objFolderItem = objFolder.ParseName("Unvr58.ttf")
objFolderItem.InvokeVerb("Install")
End Sub

Sub Unvr67
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\temp")
Set objFolderItem = objFolder.ParseName("Unvr67.ttf")
objFolderItem.InvokeVerb("Install")
End Sub

Sub Unvr68
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\temp")
Set objFolderItem = objFolder.ParseName("Unvr68.ttf")
objFolderItem.InvokeVerb("Install")
End Sub

Open in new window

0
Comment
Question by:Lorrec
  • 3
  • 2
5 Comments
 
LVL 9

Expert Comment

by:rawinnlnx9
ID: 34953020
There are more efficient ways to do it with loops and by building a list from the directory contents but this works.
0
 
LVL 9

Expert Comment

by:rawinnlnx9
ID: 34953036
Are you wanting an example just so you know?
0
 

Author Comment

by:Lorrec
ID: 34953160
An example would be great if you could show me one.
0
 

Accepted Solution

by:
Lorrec earned 0 total points
ID: 34955628
I figure it out.  
Dim Fonts(5)
Fonts(0) = "UNIVCD47.ttf"
Fonts(1) = "UNIVCD67.ttf"
Fonts(2) = "Unvr57.ttf"
Fonts(3) = "Unvr58.ttf"
Fonts(4) = "Unvr67.ttf"
Fonts(5) = "Unvr68.ttf"

For Each item In Fonts
	Set objShell = CreateObject("Shell.Application")
	Set objFolder = objShell.Namespace("C:\temp")
	Set objFolderItem = objFolder.ParseName(item)
	objFolderItem.InvokeVerb("Install")
Next

Open in new window

0
 

Author Closing Comment

by:Lorrec
ID: 34990858
Figured out how to do with with an array and loop
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Unlike scripting languages such as C# where a semi-colon is used to indicate the end of a command, Microsoft's VBScript language relies on line breaks to determine when a command begins and ends. As you can imagine, this quickly results in messy cod…
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 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