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

How to freeze a batch file or do not allow the users to close the batch file ?

Created: 03 Dec 2009 • Updated: 12 Jul 2010 • 10 comments
WiseUser's picture
+1 1 Vote
Login to vote

CMDOW is a Commandline utility that allows manipulation of open windows. This is a standalone executable for which no installation is required.

  CMDOW [window | /T] [/B] [/F] [/P]
  CMDOW /TH | /TV | /MA | /CW | /UW | /AT | /FS | /WM
  CMDOW window {[/ACT] [/INA] [/ENA] [/DIS] [/VIS] [/HID] [/MIN] [/MAX] [/RES]
        [/TOP] [/NOT] [/REN caption] [/MOV left top] [/SIZ width height] [/CLS]
  CMDOW /RUN [state] file [args]

  window  List specified window (if omitted, all windows are listed).
  /T      List windows only shown on the taskbar.
  /B      List windows using bare format (no heading information).
  /F      List windows showing full information (don't truncate any fields).
  /P      List windows showing position and size (left, top, width and height).

  /TH     Tile windows horizontally.    /TV     Tile windows vertically.
  /MA     Minimize all windows.         /CW     Cascade windows.
  /UW     Undo tile/minimize/cascade.   /AT     Intelligent [Alt]-[Tab]
  /FS     Switch to full screen mode.   /WM     Switch to window mode.

  /ACT    Activate specified window.    /INA    Inactivate specified window.
  /ENA    Enable specified window.      /DIS    Disable specified window.
  /VIS    Unhide specified window.      /HID    Hide specified window.
  /MIN    Minimize specified window.    /MAX    Maximize specified window.
  /RES    Restore specified window.     /REN    Rename specified window.
  /TOP    Make window always on top.    /NOT    Make window not always on top.
  /MOV    Move specified window.        /SIZ    Resize specified window.
  /CLS    Close specified window.       /END    Kill process linked to window.

  /RUN    Executes or opens specified file using associated application.
  state   Initial show state of window (/MIN, /MAX or /HID). Default is normal.
  args    Optional commandline arguments passed to launched application.

  Specify a window by its caption (case insensitive) or handle in hex format.
  The At symbol '@' may be used to refer to this window. For more help on any
  parameter use CMDOW /? <parameter>. Eg CMDOW /? /RUN or CMDOW /? window.

Comments 10 CommentsJump to latest comment

Pinkytwister's picture

This can be used but note that many anti-virus software will deteact it as a virus, used by hackers but can be verified by  file hash signature (MD5 or SHA) maches.  Would run /MIN but not sure what is needed for your specific Batch file.
Could run:
cmdow /run /hid my_batchfile cmd1 "cmd 2"

To run all hidden check this out:

Login to vote
riva11's picture

Nice posts, thanks both of you for these commands.

Login to vote
deepak.vasudevan's picture

Not sure many people would be comfortable to deploy scripts using this tool considering ThreatExpert summary of it as below:

Login to vote
Carsten Giese's picture

There is a small tool called HIDCON.exe that can run any batch-command in a hidden window.
The size is only 2KB and the only parameter in "-nw" means "no wait". As a default (without -nw) the program will wait for the end of the subprocess and forwards its errorcode.

Login to vote
noucktourno's picture

There are some very great sources here and thank you for being so kind to post them here. So we can read them and give our opinion on subject.

Login to vote
jayz7's picture

Can't changing the priority of the file solve the problem?

Login to vote
mozzes's picture

Thanks, I think than i'll never find this.

Login to vote
noucktourno's picture

Well worth the read. Thanks for sharing this information. I got a chance to know about the commandline utility CMDOW.

Login to vote
ohzone - CherylPeterson's picture

You can find a facebook button under the "share" dropdown menu in the upper right corner of the page.

Feel free to share any content you find interesting and useful!


Endpoint Management,
Endpoint Virtualization
Managing Mobility
Community Manager
Need Altiris help? IRC chat #Altiris

Login to vote
noucktourno's picture

I think I have just found exactly what I were looking for. I can’t thank you enough for this post about the commandline utility and would definitely not leave without expressing my gratitude and thanks through this comment. Keep up the good work. Thanks   

Login to vote