Cool Solutions

DisableClose and ShowDesktop


April 11, 2008 11:43 am






Download disableclose

By Bryan Keadle

There are times when administration via scripts/batch files via the login script are still the quicker, easier way to manage your workstations. If you don’t have ZENworks, then you especially depend on scripts for managing your workstations (right?!). However, despite all your good efforts of automation and communicating to your users about the upcoming updates, impatient or unaware users can still abort your scripts by closing the window running the process.

I realized this just recently, and decided I wanted a way to disable the control menus so that my user’s don’t kill the process.

So at the beginning of my script, I change the TITLE of the window, then run this DisableClose utility to disable the Close control menu (disable the upper-right-X button):

@echo off
TITLE Workstation Updates
DisableClose "Workstation Updates"
echo Workstation updates being applied . . .

Additionally, you may want to minimize all windows either after your script starts (so it can run in the background, suggesting that the user can continue to work while it is processing) or before your script starts (so your update script is the focus so that the user is aware of the progress), ShowDesktop.exe is the same thing as clicking on the Quick Launch’s “Show Desktop” icon:

DisableClose also enables you to disable the other control menu items, Minimize, Restore, and Maximize if you like.


 WindowName - Specify Window Name to have the close system menu disabled. 
  Case Senstive.  Partial name preceed with ~
    CLOSE - (default) disable CLOSE window system menu
 MINIMIZE - disable MINIMIZE window system menu
  RESTORE - disable RESTORE window system menu
 MAXIMIZE - disable MAXIMIZE window system menu
      ALL - disable ALL window system menus
   ENABLE - re-enable the control menus

2008-04-16: Updated to be OS-agnostic

0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.

Categories: Uncategorized

Disclaimer: This content is not supported by Micro Focus. It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test it thoroughly before using it in a production environment.