Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.
Endpoint Management Community Blog

eXpress Share Utility wndctl.exe

Created: 20 Jun 2008 • Updated: 20 Jun 2008 • 1 comment
CondorMan's picture
+1 1 Vote
Login to vote

I just discovered a nifty utility in the eXpress share called wndctl.exe. You can use it to lock the keyboard and mouse prior to any install/script and unlock it later. It can also activate, minimize, maximize, restore, hide, show, flash, close, disable, enable, tile, cascade, center, move, and resize window(s).

wndctl.exe can be found in any of the following places (in x86 and x64 versions):

  • Bootwiz\platforms\Winpe\x86\Optional\Boot
  • Bootwiz\platforms\Winpe\x64\Optional\Boot
  • Bootwiz\platforms\Winpe2\x86\Optional\Boot
  • Bootwiz\platforms\Winpe2\x64\Optional\Boot

The syntax for wndctl.exe is:

wndctl <command> [<"window title text">] [<n>]

<command> is the command to perform, and is one of the following:

-activate Make the window active
-minimize Minimize the window [for <n> seconds]
-maximize Maximize the window [for <n> seconds]
-restore Restore the window to prior state
-hide Hide the window [for <n> seconds]
-show Show the window [for <n> seconds]
-flash Flash the window title bar [<n> times (def=3, 0=forever)]
-close Close the window
-disable Disable the window [for <n> seconds]
-enable Enable the window [for <n> seconds]
-transparent[:<m>] Make the window transparent [for <n> seconds]
-opaque Make the window opaque [for <n> seconds]
-tile_h Tile all windows horizontally on desktop
-tile_v Tile all windows vertically on desktop
-cascade Cascade all windows on desktop
-center Move window to center of screen
-move:<x>,<y> Move window to <x> and <y>
-size:<w>,<h> Resize window to <w> and <h>
-top Make window topmost
-bottom Make window bottommost
-mid Make window not topmost
-title:<title> Set window title (to <title>
-poweroff[:force,noprompt] Power system off
-shutdown[:force,noprompt] Shut system down
-reboot[:force,noprompt] Reboot system
-logoff[:force,noprompt] Log user off
-lockuser[:force,noprompt] Lock workstation
-lock Lock input for all windows [for <n> seconds]
-unlock Unlock and allow input for all windows
  • <"window title text"> is the title bar text of the window to operate upon.
    • The * wildcard can be used for partial window title matches.
    • If *, then all windows are used.
    • If not specified, then the current window is used.
    • Ignored for the -lock and -unlock commands, which affect all windows.
  • <n> is the number of seconds or times before the command is terminated.
    • (Number of times to flash window for -flash command.)
    • If not specified, then the command is permanent,
    • Press any key to end before time expires.
    • Ignored for the -activate, -close, and -restore commands.

Comments 1 CommentJump to latest comment

Gibson99's picture

I am trying to use this tool to unlock the kb/m at a key point during WinPE's startup process, to give our techs an option to use some tools I've made available to the WinPE PXE boot environment. 

I currently have WinPE set to lock the kb/m (checkbox in pxe config/boot disk creator).  When i issue the unlock command via batch script inside WinPE, it doesn't unlock - it continues to ignore input from both keyboard and mouse. 

I have tried rebuilding WinPE with the "lock keyboard" option unchecked, then added wndctl -lock to the first line of userenv.bat.  This did in fact lock the keyboard and mouse pretty much right when the GUI started.  Then towards the end of startup.bat, where I want to unlock the keyboard, i put wndctl -unlock.  It runs through everything in startup.bat as it should, but it never unlocks the keyboard - it eventually gets past the delay i put in where it's listening for input, then moves on to load the Dagent. 

I'd love to be able to use this tool as intended, but it seems that once the kb/m are locked, you can't unlock them without a reboot.  which kinda defeats the purpose. 

environment:  Altiris DS 6.9 sp2, WinPE 2.1

If a Connect post helped you out, be sure to click "Mark As Solution" or the "Thumbs Up" button to let other users know about it.

Login to vote