cmdow-A Win32 Window Management command-line tool

Source: Internet
Author: User
Tags win32 window

Recently there is a demand, will the same program run 8 instances, and according to the rules in two windows distribution, this thought with bat can be achieved, the results found not so easy, searched for a long time to find this tool cmdow.exe, found this thing really good.

Meet the needs of our project: Single file, offline, free installation, very worry.

Direct bat calls, can achieve a lot of functions, but our request this time with bat implementation is still relatively difficult (BAT's for loop assignment combined operation is difficult to do), so the combination of C # implementation.

The first part of the Easy start tutorial

Cmdow: Show All Processes

CMDOW/T: Show all processes on taskbar

CMDOW/T/P: Displays all the processes on the taskbar and displays their window position and size

Part II

cmdow/th | /TV | /CW | /ma | /uw | /at | /fs | /wm
These are the commands for the Distribution window, for all windows, see official documentation for details

Part III

Cmdow window {[/act] [/ina] [/ena] [/dis] [/vis] [/hid] [/min] [/max] [/res]} cmdow window {[/ren newcaption] [/top] [/not ] [/mov left Top] [/siz width height] [/cls] [/end]}

For a specific window of the operation, just describe what I use:
First of all, how to determine which window?
With cmdow/t, you can see the Handle (first column) of the process and caption (the last column)

Specific windows can be specified using Handle or Caption, but Handle is recommended because it is unique (Caption may exist, such as "Ue4_program (64-bit, PCD3D_SM5)" in two instances)

For example, set the window size and position in Ue4_program (64-bit, PCD3D_SM5):

Cmdow 0x080a30/siz 500 500

Cmdow 0x080a30/mov 0 0

This method can be specifically set to an instance.

Or:

Cmdow "Ue4_program (64-bit, PCD3D_SM5)"/siz 500 500

Cmdow "Ue4_program (64-bit, PCD3D_SM5)"/mov 0 0

This method can only be blurred to find, in the two UE4 process selected to set, note, because caption contains spaces, so the name is enclosed in quotation marks.

Fourth part

Examples of OTHER commands:

/hid can hide the process, the taskbar and the system tray are not visible (no wonder Cmdow easy to kill by anti-virus software, it is easy to secretly do bad things)

/cls to close the task

Fifth part

You can also use Cmdow to start a process in the following format:

Cmdow/run [State] file [args]

Where state can be one of these three parameters:/max/min/hid, which is maximized, minimized, and hidden

File is the executable file to execute, and if the name contains a space, enclose it in double quotation marks. Args is the other parameter of the executable (the program defines it itself)

Sixth part

Some of the official use cases:

Close all the processes on the taskbar:

@echo off
:: Hide This console window so it is shown on taskbar
Cmdow @/hid
for/f%%a in (' cmdow/t ') do Cmdow%%a/cls
:: Now close this console window
Cmdow @/cls

Output the current screen size: (level is a 0 process is a special process, can get the current screen resolution through him)

@echo off
for/f "Tokens=2,10-11"%%a in (' cmdow/p ') does (
If "%%a" = = "0" set "width=%%b" & Set "Height=%%c"
)
Echo Resolution is%width%x%height%

According to the official case, we can also easily write such a function:
For example, set the window size of all processes named Ras_general to 800*800, and move the window position to 0, 0 points:

@echo off

for/f "tokens=1,9"%%a in (' cmdow/t ') does (

If "%%b" = = "Ras_general" (

Cmdow%%a/siz 800 800

Cmdow%%a/mov 0 0

)

)

cmdow-A Win32 Window Management command-line tool

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.