Solved

Install fonts with vbs

Posted on 2011-02-22
5
1,711 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
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…

749 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