Solved

Install fonts with vbs

Posted on 2011-02-22
5
1,630 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
Comment Utility
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
Comment Utility
Are you wanting an example just so you know?
0
 

Author Comment

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

Accepted Solution

by:
Lorrec earned 0 total points
Comment Utility
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
Comment Utility
Figured out how to do with with an array and loop
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Welcome to part one of a multi-part tutorial series, VBScript for Windows System Administrators.  The goal of this series is to teach non-programmers how to write useful VBS code to automate their environment, and perform tasks faster, and in a more…
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now