General discussion


Close folder with Command line

By jlbpotter ·
I amy using a batch file in a logon script to copy a font to every PC in my domain. I have no problem copying the font to the Fonts folder but it doesn't seem to work until the user opens up the Fonts folder in the Control Panel. Using my script I can open the fonts folder also, but I can't figure out how to close the windows explorer fonts folder after it is opened. I don't want the user to have to close this folder everytime they log on. Can someone tell me how to close this window from the command line?
Thanks in advance.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by w2ktechman In reply to Close folder with Command ...

AutoIt ( is a free automation tool used to send key and mouse commands to Windows objects.

Collapse -

by jlbpotter In reply to

Poster rated this answer.

Collapse -

by sgt_shultz In reply to Close folder with Command ...
Collapse -

by jlbpotter In reply to Close folder with Command ...

This question was closed by the author

Collapse -


by otaxige In reply to Close folder with Command ...

(CHANGE <b>"YourWindowTITLEEE"</b> and "yourFile.vbs" to whatever you want. Below is just an example:)

open a new text document and enter this code:

Set oShell = CreateObject("WScript.Shell")
If oShell.AppActivate("YourWindowTITLEEE") Then
WScript.Sleep 100
oShell.SendKeys "%{F4}"
End If

then save that file as yourFile.vbs and put to your desired path. Then run the Command:

%windir%\system32\cmd.exe /C "START /WAIT CScript C:\yourFile.vbs //NoLogo"

Related Discussions

Related Forums