Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Close window with batch file

Status
Not open for further replies.

lawre016

Technical User
Apr 9, 2002
13
US
We recently installed a new font to every machine using the login script. For some reason the font will not show up on forms unless it is "initialized" first - I did this by just opening the Fonts folder and all was well. My problem is that I don't want to go to every machine and open the fonts folder. I want to add something to the login script to open AND close the fonts folder (or some how 'initialize' the font).. Opening is no problem START c:\winnt\fonts
but, is there a way I can close the window?

Thanks!
 
Did you add the registry entries as well for those fonts?
Remotely copying a font to a machine will not install it...the registry entries must be made as well.

Also - reboots are required once the font is copied from a script, and the regedits are made.

BTW - just add an exit line at the bottom of a batch file to close the window - "fonts.bat" could contain:

copy *.ttf c:\winnt\fonts\*.*
exit

Hope that helps. pbxman
Systems Administrator

Please let Tek-Tips members know their posts were helpful.
 
Nope, no registry entries. Since it works fine after I open the fonts folder, I figured it was ok.

Actually, I need to close the C:\WINNT\Fonts window that the batch opened, not the cmd window the batch is running from. I just don't want users to call because that window is open on their screen when they login...

Thanks.
 
Have you tried adding pause at the end of the batch file and seeing if there's any error messages associated with it? Glen A. Johnson
Microsoft Certified Professional
gjohn76351@msn.com

"Man is not weak; knowledge is more than equivalent to force."
Samuel Johnson (1709-84), English author, lexicographer.
 
lawre016,

I know of no way to close an explorer window after it is initialized from a login script without using javascript. Maybe someone else does - but it's not the way your task should be done. Copying the files, and registering them in your registries is the proper way to install fonts from batch.

If it works by opening the fonts folder, you'll have to have the users close the window. That is beyond the capabilities of a loginscript.

I can post a sample batch along with a sample .reg file to use in your batch file if you need assistance, but there is no "close window" command referring to explorer.exe since explorer.exe represents a shell, not a specific window or task within the shell.

Good luck though - maybe someone knows a command im not aware of? I'd really like to see it if you get it working.
Let me know if you want to see a sample of how to install fonts using a .bat file and a .reg file calling from a logonscript. pbxman
Systems Administrator

Please let Tek-Tips members know their posts were helpful.
 
I couldn't find a way to close it either, but I thought I'd ask just in case I too was missing something.
I would really appreciate if you could show me the correct way to install fonts using the login script.

Thanks.
 
Yeah - ive been looking too - can't find how to close the window ;)

Anyway, here's what i did and it took about 5 min. Copy the .bat, .reg, and the .ttf files to your logonserver's Netlogon share (same dir as the logonscript they run):
"fonts.bat" contained (for my application):

@echo off
copy ABC39Short.TTF %SystemRoot%\fonts\*.*
regedit /y /s Fonts.reg
exit

You'll notice i use a registry command as well. The Fonts.reg file contains:

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
"ABC C39 Short (TrueType)"="ABC39Short.TTF"

Notice also that the registry name, and actual font name are different. In the registry the file "ABC39Short.ttf" is DISPLAYED as ABC C39 Short (TrueType). Thats why it is important to properly register the font. Not all fonts behave in this manner.

So - you copied the fonts.bat, fonts.reg, and the .ttf font files to your netlogon share...now to get the script to run them. In my case - im using Kixtart and added:

IF INGROUP("Claims")
? "Installing New Fonts..."
Shell @STARTDIR+"\Fonts.BAT"
ENDIF


If you're using NT's regular logonscript in a .bat file, just add Fonts.bat in there, and let it run.

Hope that helps.

pbxman
Systems Administrator

Please let Tek-Tips members know their posts were helpful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top