Discussion Locked

Close folder with Command line

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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.

5 replies

by otaxige

(CHANGE "YourWindowTITLEEE" 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"

This discussion is closed to new replies.