VBScript Shell.Application Delete File

Good morning,

Is it possible to use the Shell.Application object to delete a file? I am trying the delete a font from C:\Windows\Fonts using Scripting.FileSystemObject but even though it has been removed the file is shown until the machine is rebooted. I am hoping that by deleting the file using Shell.Application (which is used to install the Font) it will be successfully removed without the requirement for a reboot.

Thanks,

Michael
LVL 1
Barnardos_2LSAsked:
Who is Participating?
 
RobSampsonCommented:
In the registry, under HKLM\Software\Microsoft\Windows NT\CurrentVersion\Fonts\ is there any other reference to a font of a similar name (like a TrueType version) that we might need to get rid of as well?  On my Windows XP SP3 machine when I remove a TrueType font, it disappears.

The Shell.Application object does have any method to delete a file.

I have read that if you run
net stop wmiapsrv
and
net start wmiapsrv
after deleting a font, it can refresh the list, but I'm not sure.

A little more research provided this:
http://msdn.microsoft.com/en-us/library/dd144833(v=vs.85).aspx

which states you need to make an API call to SendMessage to send a WM_FontChange notification to the system.  Unfortunately, this is not possible in VBScript.

Regards,

Rob.
0
 
RobSampsonCommented:
Hi, as shown here:
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24175018.html

you need to remove the associated registry entry as well, but it requires knowing the full font name.

Regards,

Rob.
0
 
Barnardos_2LSAuthor Commented:
The registry entries were removed however the font files are still present (see attached image). These disappear when the machine is rebooted.
Fonts.bmp
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
RobSampsonCommented:
Which OS are you on?  It works on Windows XP if you refresh the Fonts folder.  Do you have any programs open that might reference the install fonts?

Regards,

Rob.
0
 
Barnardos_2LSAuthor Commented:
The OS is Windows XP SP3. The fonts show as TrueType instead of OpenType when the screen is refreshed and then following a reboot the files are removed. No programs are open which could be referencing the fonts. Is it possible to use the Shell.Application object to delete a file as this may be another option as deleting them manually in Explorer works first time?
0
 
Barnardos_2LSAuthor Commented:
Thanks for your help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.