Giter VIP home page Giter VIP logo

cmdow's Introduction

Table of Contents

Is Cmdow Malware?

Of course not! However, not everyone agrees... One of Cmdow's many features allow the user to hide program windows which has led to 40% of anti-virus vendors classifying Cmdow as anything from a hacking tool to a trojanโ€ . On the other hand, 60% of anti-virus vendors regard Cmdow as completely safe.

You can view the anti-virus scan results yourself. Download and extract the latest version of the Cmdow archive, then upload cmdow.exe to VirusTotal. You'll end up at a page like this: https://virustotal.com/en/file/767b877e735c425bf05c34683356abfde4070b092f17a4741ea5ac490611f3de/analysis/ (note, the long hexadecimal string in the URL matches the SHA256 checksum of cmdow.exe, v1.4.8 in this instance).

Obviously, if you have any doubts about the safety of Cmdow then don't use it or audit the source code yourself. Auditing should be fairly straightforward as the code is self explanatory with liberal comments and there is no assembly or binary blobs. It compiles without errors or warnings using the free Code::Blocks IDE. There is even a Code::Blocks project file (cmdow.cbp) included in the Cmdow download.

โ€  Ten vendors actually regard passing a zero to the Windows API function ShowWindowAsync as enough to create a trojan!

Synopsis

Cmdow is a Win32 commandline utility for NT4/2000/XP/2003/2008/7 that allows windows to be listed, moved, resized, renamed, hidden/unhidden, disabled/enabled, minimized, maximized, restored, activated/inactivated, closed, killed and more.

It is a small standalone executable. It does not create any temporary files, nor does it write to the registry. There is no installation procedure, just run it. To completely remove all traces of it from your system, delete it.

Cmdow was written with batch file programmers in mind. Particular attention has been paid to Cmdows output making it easy to process with the 'FOR /F' command found in the Windows command processor (cmd.exe).

Cmdow is simple and intuitive to use. To list all its options, type:-

cmdow /?

Usage

This form of CMDOW lists window details.

  CMDOW [window | /T] [/B] [/F] [/P]

  window  Window to list. Specify a window by its handle (in hex format, eg
          0x1A0142) or caption (window title). Caption is case insensitive.
          Use asterisk before/after caption to match zero or more characters.
          Windows without captions are matched by their ClassName. Use double
          quotes for captions containing whitespace or control characters. The
          At symbol '@' may be used to refer to this window. eg 'CMDOW @ /HID'.
  /T      List only the windows shown on the taskbar (these are typically
          visible level 1 windows that do not have an owner).
  /B      Bare format. Does not print the field names when listing windows.
  /F      Full format. By default CMDOW truncates Image names to eight
          characters and Captions/ClassNames to fit under 80 characters.
          Use this option to disable this feature.
  /P      Shows window position, coords of top left corner of the window and
          its absolute width and height in pixels.

Here is a description of the output fields:-

  Handle         Handle of the window, in hexadecimal format (0x000123AB).
  Lev            Level of the window. The desktop window at level 0 is the area
                 on which all other windows are painted. Top level windows are
                 level 1 (and may be shown on the taskbar), all windows of
                 level 2+ are child windows.
  Pid            Process Id of the window (Task Manager also shows Pids).
  Window status  How the window is displayed (Minimized, Maximized, Restored,
                 Active, Inactive, Enabled, Disabled, Visible or Hidden).
  Left, Top      Coords of left top corner of the window relative to the
                 parent window. For top level windows this is the desktop, and
                 for child windows it is their top level window.
  Width, Height  Absolute width and height of the window in pixels.
  Image          Executable that created the window (Task Manager also shows
                 Image Names on its Process tab).
  Caption        Window title. If a window has no caption, its ClassName is
                 listed instead.

This form of CMDOW performs a single action typically affecting all windows.

  CMDOW /TH | /TV | /CW | /MA | /UW | /AT | /FS | /WM

  /TH     Tiles all windows horizontally. Functionally equivalent to right-
          clicking the taskbar and selecting 'Tile Windows Horizontally'.
  /TV     Tiles all windows vertically. Functionally equivalent to right-
          clicking the taskbar and selecting 'Tile Windows Vertically'.
  /CW     Functionally equivalent to right-clicking the taskbar and selecting
          'Cascade Windows'.
  /MA     Minimizes all windows. Functionally equivalent to right-clicking the
          taskbar and selecting 'Minimize All Windows' or using the keyboard
          shortcut Win+M. A window may not be minimized if it has a modal
          dialog box open (typically the window displayed by Help | About).
  /UW     Undo the effect of /TH, /TV, /CW and /MA. Functionally equivalent to
          right-clicking the taskbar and selecting 'Undo...' or using the
          keyboard shortcut Win+Shift+M.
  /AT     Similar to the keyboard shortcut Alt+Tab but instead of activating
          the next highest window in the Z order, /AT activates the window at
          the bottom of the Z order. Consequently, /AT can be used to activate
          every window on the taskbar sequentially. To prevent windows on the 
          taskbar from flashing, set the following registry value to zero:-
          HKCU\Control Panel\Desktop\ForegroundLockTimeout.
  /FS     Switch the window running this process into full screen mode.
  /WM     Switch the window running this process into window mode.

This form of CMDOW performs specified action(s) on the specified window(s). Some of these commands allow you to manipulate windows in ways not normally possible. Improper use may cause unexpected results and system instability.

  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]}

  window  Window to act on. Specify a window by its handle (in hex format, eg
          0x1A0142) or caption (window title). Caption is case insensitive.
          Use asterisk before/after caption to match zero or more characters.
          Windows without captions are matched by their ClassName. Use double
          quotes for captions containing whitespace or control characters. The
          At symbol '@' may be used to refer to this window. eg 'CMDOW @ /HID'.
  /ACT    Activates the specified window. It's possible to activate a hidden
          and/or disabled window (although doing so will not make it visible or
          enabled). If a minimized window is activated, it remains minimized.
  /INA    Inactivates the specified window (activates a window shown on the
          taskbar with the lowest Z order). If the specified window is already
          inactive or it is the only window shown on the taskbar, then /INA has
          no effect. This action added for completeness rather than usefulness.
  /ENA    Enables the specified window (allowing user interaction).
  /DIS    Disables the specified window. A disabled window will continue to run
          as usual, although it will not accept user input until it is enabled.
  /VIS    Unhides the specified window (make it visible).
  /HID    Hides the specified window. Although a hidden window will not be
          shown on the taskbar, it will still run and may be unhidden later.
  /MIN    Minimizes specified window. Not all windows can be minimized, dialog
          boxes for instance.
  /MAX    Maximizes specified window (even those not having a Maximize button).
  /RES    Restores the specified window to its former size and position. If a
          minimized window was originally maximized, then /RES will maximize
          the window. Applying /RES a second time, will restore the window to
          the size and position it was before it was maximized.
  /REN    Renames the caption of the specified window to the caption specified
          after /REN. Use double quotes for captions containing whitespace.
  /TOP    Makes the specified window always on top. It will remain on top even
          when another window is activated. If two or more windows have this
          attribute set, the topmost window will be that which had the
          attribute set first.
  /NOT    Makes window not always on top. This is the normal setting for most
          windows.
  /MOV    Moves the specified window. The left and top arguments specify the
          new position of the left top corner of the window. For level one
          windows this is relative to the desktop, and for child windows this
          is relative to its parent window. Level one windows can be moved off
          the screen using negative coords or coords greater than the desktop
          size. You should not move a minimized or maximized window without
          first restoring it.
  /SIZ    Resizes the specified window. The width and height arguments specify
          the new absolute width and height. In general, windows cannot be made
          smaller using /SIZ than they could if using conventional methods. You
          should not resize a minimized or maximized window without first
          restoring it.
  /CLS    Politely asks the specified window to close. Most applications will
          respond to this request, although some may display a message box
          asking you what to do with unsaved work.
  /END    Kills the process associated with the specified window, the result is
          all windows with the same Pid are also killed. Use very carefully.

  If more than one window matches the specified caption, CMDOW only acts on the
  first one. To override this add the /DBM (Don't Blame Me) switch - DANGEROUS.
  Multiple actions are performed in order, from left to right. Eg:-

    CMDOW 0x0E0144 /hid /ren "10% complete" /mov 0 0 /siz 300 100 /act /vis

This form of CMDOW executes the specified file or opens it using the application associated with the filename extension.

  CMDOW /RUN [state] file [args]

  /RUN    Executes the specified file if possible, otherwise opens it using the
          application associated with the filename extension.
  state   Requests how the application's window is initially displayed. Use
          /MIN for minimized, /MAX for maximized and /HID for hidden. If
          omitted the application is started in its default show state. Some
          applications ignore this, use CMDOW to alter the window state after
          the application has started.
  file    File to execute/open. Use double quotes if filename contains spaces.
  args    Optional arguments passed on to the application. Specify any args
          exactly as you would if executing/opening the file directly.

Examples

View the Cmdow main help screen:-

cmdow /?

View help about the /MOV (move a window) option:-

cmdow /? /mov

To list details of all windows:-

cmdow

To list details of only the windows listed on the taskbar:-

cmdow /t

To list details and positions of only the windows listed on the taskbar:-

cmdow /t /p

To list details of a particular window:-

cmdow "untitled - notepad" or Cmdow 0x010052

where 0x010052 is the window handle of the window titled "untitled - notepad".

Tile all windows vertically:-

cmdow /tv

Bearing in mind that the Cmdow actions are carried out in the order in which they are specified (that is, from left to right), this example restores, moves, renames and finally activates Calc.exe:-

cmdow Calculator /res /mov 100 200 /ren "New Caption" /act

Batch file to activate a different window every 10 seconds:-

@echo off
:loop
cmdow /AT
ping 127.0.0.1 -n 11 >nul
goto :loop

Batch file to close all windows listed on the taskbar:-

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

Stupid batch file to remove all the buttons from Calculator:-

@echo off
:: run calc and give it time to fully load
start calc & ping 127.0.0.1 -n 2 >nul
:: hide windows at level 2 and whose image is calc
for /f "tokens=1-2,8" %%a in ('cmdow') do (
  if /i "%%c"=="calc" if "%%b"=="2" cmdow %%a /hid
)

Batch file to retrieve display resolution. The co-ords of the first window listed by Cmdow is the screen resolution (this window also has a level of zero which can be identifed using FOR /F):-

@echo off
for /f "tokens=2,10-11" %%a in ('cmdow /p') do (
  if "%%a"=="0" set "WIDTH=%%b" & set "HEIGHT=%%c"
)
echo Resolution is %WIDTH%x%HEIGHT%

Run a program hidden:-

cmdow /run /hid myprog.exe

Run a batch file hidden passing it parameters:-

cmdow /run /hid mybat arg1 "arg 2"

Batch file to alert Administrator if the number of windows shown on the taskbar changes (as might be the case when an application or the operating system generates an error message, or may be backup software is prompting for a tape etc). Loops every 60 seconds until number of windows changes.

@echo off&setlocal&set LAST=
cmdow @ /hid
:loop
ping 127.0.0.1 -n 61 >nul & set "THIS=0"
for /f %%a in ('cmdow /t /b') do set /a THIS+=1
if not defined LAST set "LAST=%THIS%"
if %THIS% NEQ %LAST% (goto :alert) else (set LAST=%THIS%)
goto :loop
:alert
net send administrator Change in windows on taskbar.
cmdow @ /vis

Creating an Autorun CD. Copy your autorun.inf file and cmdow.exe to the root of the CD. Here is a sample autorun.inf. It also shows how add a context menu for the CD. This could be used to install software required by your CD or to view a readme file etc:-

[autorun]
open=cmdow /run /max \video.mpg
icon=myicon.ico
shell\readme=Read &Me
shell\readme\command=cmdow /run \readme.htm
shell\install\=&Install Realplayer
shell\install\command=rp8-complete2-u1-setup.exe

Here is another use suggested by a Cmdow user:-

Cmdow can be used to save the window status and restore it, after the execution of a program. For example, if you are displaying information in a maximised Command Prompt window and then need to call a program (NOTEPAD, perhaps), which gives a second window, the current Command Prompt window is minimised to the taskbar. You would normally need to click on it to restore the original window and give it the focus. You can use CMDOW to save the status of the window, and cause it to be restored automatically in a maximised form, using the following:

:: save the current window status
for /f "tokens=4" %%a in ('cmdow @ /b') do set wstate=%%a
:: call NOTEPAD to display this BATch file (or anything else!)
call notepad "%~f0"
:: (it is assumed that the user now closes the NOTEPAD window)
:: if the window status was maximised previously, return it to that state
if "%wstate%"=="Max" cmdow @ /max
echo Here we are again, back in our maximised window!

FAQs

How can I filter on image name and caption?

See issue 5.

How can I filter on multiple window properties, for example, visible explorer.exe windows wider than 1000 pixels?

See issue 4.

How can I disable or hide the desktop?

Running Cmdow without any options lists all windows. The window at the top of the list is the desktop window only as far Windows is concerned (and has a level of 0). However, the window that you and I know as the desktop is found at the end of the list. It will typically be the last window listed with a level of 1 (and by default its caption is "Program Manager"). So running Cmdow "Program Manager" /hid will hide the deskop. If you have another window titled "Program Manager", then you'll need to use an alternative method. See the example scripts.


On a W2K machine running a number of applications that monitor our servers and networks, I have a batch file that runs Cmdow /AT every 20 seconds. Sometimes Cmdow fails to activate an application window, instead the taskbar flashes blue.

This is a new 'feature' of W2K. Its known as Foreground Lock Timeout, and basically prevents another application setting the foreground window. You can safely disable this feature using TweakUI or by setting the value of this registry key to zero:-

  HKEY_CURRENT_USER\Control Panel\Desktop\ForegroundLockTimeout

When I use Cmdow at a command prompt or in a batch file and try to change the console title. Why does the title revert back when Cmdow finishes or when the batch file ends?

This has been fixed in version 1.4.1.


How can I undo the effects of tiling, cascading or minimizing all windows?

In version 1.4.2 the /UM switch has been superseded by /UW. This new switch will undo the effect of tiling/cascading and minimizing all windows. To maintain compatability with existing scripts, the /UM switch can still be used even though it's no longer documented on Cmdow's helpscreen. /UM now has exactly the same effect as /UW.

Screenshots

Screenshot of Cmdow

Screenshot of Cmdow

Screenshot of Cmdow

Screenshot of Cmdow

Screenshot of Cmdow

Screenshot of Cmdow

Revisions

Revision Date Changes
1.4.8 2014-12-30 Help page typos corrected. Output can handle 5-digit PIDs.
1.4.7 2014-12-29 Wildcards can now be used to filter window captions. Also now possible to perform actions on multiple windows. Handle display is extended to eight digits. Level is dynamically sized. Class name is dynamically sized. Newlines in the caption are converted to 1.4.4
1.4.3 2004-12-19 Fixed bug where renaming the current console window would fail if the new caption title contained whitespace. Sizes are based on the entire window list, not just what is displayed. Help pages updated. Internally: Remove process name length test, as WideCharToMultiByte already restricts it. Combined multiple printfs. Substituted some if/else assignments for ternary operator.
1.4.2 2003-08-18 /UM seperseded by /UW switch. See FAQ's for details.
1.4.1 2003-05-14 Cmdow can now rename the console window that launched it. Previously the title would revert when Cmdow exited.
1.4 2002-11-07 Added /TOP and /NOT options to allow the setting/clearing of windows 'always on top'. Fixed argument parsing bug for /MOV and /REN options.
1.3 2002-11-20 Added /FS and /WM options to allow switching between full screen mode and window mode.
1.2 2002-10-29 Fixed issue caused when conole windows have no title. Enhance /AT feature to restore an activated window if it was minimized.
1.1 2002-02-25 Added /RUN command.
1.0 2001-12-20 Cmdow created.

Copyright and License

Code and documentation copyright 2001-2014 Ritchie Lawrence. Code released under MIT License

cmdow's People

Contributors

ritchielawrence avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cmdow's Issues

Save and restore file explorer windows?

Hello - Is it possible and how would I find all visible explorer windows listed in the taskbar, restart explorer.exe, then restore the previously found explorer windows? Thank you :)

Feature request, FONT and COLOR

Any possibility to add adjustment of font size and color? Can't seem to find a way to adjust the font size at command line. Also, the basic COLOR command is pretty color limited.

Anyway, finding this tool pretty handy, thanks!

Monitors orientation (move app to the other monitor)

Is there some way to identify the orientation of the two monitors on my computer? What monitor is on the left and what monitor is on the right?

image

I've implemented a script to open the Internet Explorer on full-screen on a specific monitor passing two parameters to the script.

First parameter is the orientation that can receive two values: normal (the monitor 1 is configured on the left of monitor 2) and reversed (the monitor 1 is configured on the right of the monitor 2)

Second parameter is the side that you want to open the Premiere window that can receive two values: left (premiere will open on the left) or right (premiere will open on the right)

@echo off
del ~.txt /q /f >nul 2>nul
start "" /w dxdiag /t ~
setlocal enableDelayedExpansion
set currmon=1
for /f "tokens=2 delims=:" %%a in ('find "Current Mode:" ~.txt') do (
    echo Monitor !currmon! resolution is %%a
    SET RESOLUTION!currmon!=%%a
    set /a currmon=currmon+1
)
for /f "tokens=1,3 delims= " %%a in ('echo !RESOLUTION1!') do (
    set "WIDTH1=%%a" & set "HEIGHT1=%%b"
)
for /f "tokens=1,3 delims= " %%a in ('echo !RESOLUTION2!') do (
    set "WIDTH2=%%a" & set "HEIGHT2=%%b"
)
del ~.txt /q /f >nul 2>nul

start iexplore.exe -k http://www.google.com

if "%1"=="reversed" (
    if "%2"=="right" (   
        cmdow "*Internet Explorer*" /res /siz !WIDTH1! !HEIGHT1! /mov 0 0 /act
    ) else (    
        cmdow "*Internet Explorer*" /res /siz !WIDTH2! !HEIGHT2! /mov -!WIDTH2! 0 /act
    )
) else (
    if "%2"=="right" (   
        cmdow "*Internet Explorer*" /res /siz !WIDTH2! !HEIGHT2! /mov !WIDTH1! 0 /act
    ) else (
        cmdow "*Internet Explorer*" /res /siz !WIDTH1! !HEIGHT1! /mov 0 0 /act
    )
)
endlocal

For example, considering the orientation of the monitors is "reversed" (monitor 1 on the right of the monitor 2):

image

and you want to open the IE on left (monitor 2), so you should execute this command:

.\premierclient-server-version.cmd reversed left

Is there someway to get the orientation programatically instead of pass as a parameter?

A request - not an issue

Ritchielawrence, amazing tool! Is there a way to get this also uploaded on the SourceForge website? The company I work for does not allow files from Github but allows from SourceForge. I would love to get this approved by the company to begin using it. Used it for personal use and it works miracles.

Filters

Currently you can only filter by taskbar or window name (Caption). It would be useful to be able to filter by other criteria such as:

  • Image name
  • Window Status
    • Visibility: Visible or Hidden
    • Minimized, Maximized, Restored,
    • Active, Inactive
    • Enabled, Disabled
  • Level - i.e. filter to top level windows.
  • Size
  • Has size (width/height not 0)
  • width / height is =/>/<
  • position?

/RUN /MOV and /SIZ in a single command?

Not an issue, but a question. I hope I'm not asking at the wrong place. I'd like to open a new microsoft-edge window and then set its location and size.

Trying:
cmdow.exe /RUN "microsoft-edge:http://www.page.com/location /mov 1000 100 /siz 200 500
Doesn't seem to do what I'm hoping for.

The best I can find is to launch the program and then move it by its name, but I have to figure out its name. So it goes.

Title titlestring doesn't work

In Windows 10 x64, if using "cmdow /ren titlestring" changes title of cmd prompt window, then command of "title titlestring" doesn't work.
2020-10-19_004323

add delay parameter

This is a feature request.
It would be nice to have a /WAIT [seconds] parameter to perform any action.

I now the ping localhost trick to pause any bat, but for my use case having this feature integrated is lot better.

Making windows Click-Through

Is it possible to make windows click-through, so when they are /TOP they cannot be interracted with? (I'm aware of /DIS).

Build failed

I am building cmdow project using codeBlocks and GNU GCC Compiler. But getting error as :
image

tlist.cpp uses depreciated MAKELANGID()

From winnt.h

//  DEPRECATED: The LCID/LANGID/SORTID concept is deprecated, please use
//  Locale Names instead, eg: "en-US" instead of an LCID like 0x0409.
//  See the documentation for GetLocaleInfoEx.
//
//  A language ID is a 16 bit value which is the combination of a
//  primary language ID and a secondary language ID.  The bits are
//  allocated as follows:
//
//       +-----------------------+-------------------------+
//       |     Sublanguage ID    |   Primary Language ID   |
//       +-----------------------+-------------------------+
//        15                   10 9                       0   bit
//
//  WARNING:  This pattern is broken and not followed for all languages.
//            Serbian, Bosnian & Croatian are a few examples.
//
//  WARNING:  There are > 6000 human languages.  The PRIMARYLANGID construct
//            cannot support all languages your application may encounter.
//            Please use Language Names, such as "en".
//
//  WARNING:  There are > 200 country-regions.  The SUBLANGID construct cannot
//            represent all valid dialects of languages such as English.
//            Please use Locale Names, such as "en-US".
//
//  WARNING:  Some languages may have more than one PRIMARYLANGID.  Please
//            use Locale Names, such as "en-FJ".
//
//  WARNING:  Some languages do not have assigned LANGIDs.  Please use
//            Locale Names, such as "tlh-Piqd".
//
//  It is recommended that applications test for locale names rather than
//  attempting to construct/deconstruct LANGID/PRIMARYLANGID/SUBLANGID
//
//  Language ID creation/extraction macros:
//
//    MAKELANGID    - construct language id from a primary language id and
//                    a sublanguage id.
//    PRIMARYLANGID - extract primary language id from a language id.
//    SUBLANGID     - extract sublanguage id from a language id.
//
//  Note that the LANG, SUBLANG construction is not always consistent.
//  The named locale APIs (eg GetLocaleInfoEx) are recommended.
//
//  DEPRECATED: Language IDs do not exist for all locales

Second monitor resolution

Hi,

how can I retrieve the screen/monitor resolution of the second screen/monitor considering a computer with two monitors/screens?

There is a similar solution on example for the first monitor/screen:

Batch file to retrieve display resolution. The co-ords of the first window listed by Cmdow is the screen resolution (this window also has a level of zero which can be identifed using FOR /F):-

@echo off
for /f "tokens=2,10-11" %%a in ('cmdow /p') do (
  if "%%a"=="0" set "WIDTH=%%b" & set "HEIGHT=%%c"
)
echo Resolution is %WIDTH%x%HEIGHT%

x64 does not build using CL

I don't want to install codeblocks so I just took a look at the cbp and it looks very straightforward so I reviewed the code and found the required libraries: user32, advapi32, and shell32 so this should be as simple as cl *.cpp /link user32.lib advapi32.lib shell32.lib /OUT:cmdow.EXE
so I tried that, and I saw some concerning warnings...

Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29111 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

args.cpp
args.cpp(256): warning C4312: 'type cast': conversion from 'unsigned long' to 'HWND' of greater size
help.cpp
main.cpp
tlist.cpp
tlist.cpp(126): warning C4311: 'type cast': pointer truncation from 'PPERF_DATA_BLOCK' to 'DWORD'
tlist.cpp(126): warning C4312: 'type cast': conversion from 'unsigned long' to 'PPERF_OBJECT_TYPE' of greater size
tlist.cpp(127): warning C4311: 'type cast': pointer truncation from 'PPERF_OBJECT_TYPE' to 'DWORD'
tlist.cpp(127): warning C4312: 'type cast': conversion from 'unsigned long' to 'PPERF_COUNTER_DEFINITION' of greater size
tlist.cpp(138): warning C4311: 'type cast': pointer truncation from 'PPERF_OBJECT_TYPE' to 'DWORD'
tlist.cpp(138): warning C4312: 'type cast': conversion from 'unsigned long' to 'PPERF_INSTANCE_DEFINITION' of greater size
tlist.cpp(142): warning C4311: 'type cast': pointer truncation from 'PPERF_INSTANCE_DEFINITION' to 'DWORD'
tlist.cpp(142): warning C4312: 'type cast': conversion from 'unsigned long' to 'LPSTR' of greater size
tlist.cpp(154): warning C4311: 'type cast': pointer truncation from 'PPERF_INSTANCE_DEFINITION' to 'DWORD'
tlist.cpp(154): warning C4312: 'type cast': conversion from 'unsigned long' to 'PPERF_COUNTER_BLOCK' of greater size
tlist.cpp(155): warning C4311: 'type cast': pointer truncation from 'PPERF_COUNTER_BLOCK' to 'DWORD'
tlist.cpp(155): warning C4312: 'type cast': conversion from 'unsigned long' to 'LPDWORD' of greater size
tlist.cpp(156): warning C4311: 'type cast': pointer truncation from 'PPERF_COUNTER_BLOCK' to 'DWORD'
tlist.cpp(156): warning C4312: 'type cast': conversion from 'unsigned long' to 'PPERF_INSTANCE_DEFINITION' of greater size
wlist.cpp
wlist.cpp(263): warning C4311: 'type cast': pointer truncation from 'HWND' to 'unsigned long'
wlist.cpp(497): warning C4311: 'type cast': pointer truncation from 'HWND' to 'long'
wlist.cpp(600): warning C4311: 'type cast': pointer truncation from 'HINSTANCE' to 'int'
Generating Code...
Microsoft (R) Incremental Linker Version 14.27.29111.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:args.exe 
user32.lib 
advapi32.lib 
shell32.lib 
/OUT:cmdow.EXE 
args.obj 
help.obj 
main.obj 
tlist.obj 
wlist.obj 

well warnings aren't build errors so I figured let's just give it a try
cmdow no output cmdow /t no output...
Well I guess there's something not right here. I switch to x86 cross tools and link to the 32 bit versions of these libraries using the same command and it works? Builds with no warnings:

Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29111 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

args.cpp
help.cpp
main.cpp
tlist.cpp
wlist.cpp
Generating Code...
Microsoft (R) Incremental Linker Version 14.27.29111.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:args.exe
user32.lib
advapi32.lib
shell32.lib
/OUT:cmdow.EXE
args.obj
help.obj
main.obj
tlist.obj
wlist.obj

So for one reason or another there are changes to the Windows API that prevents your program from running if linked to x64 libraries.

/? not working

cmdow.exe /? just outputs:
Error: Unrecognized argument(s). Use CMDOW /? for help.

Moving 5 windows won't work

I was trying to move 5 putty windows by running cmdow.exe "*putty" /MOV 333 5.

The only window that was moving was the last open one (i'm open 5 putty windows from a batch file and i run this command last). If i activated another window and then run the above command the window moves. So i was forced to activate every putty window before i ran the command.

I don't know if i'm doing something wrong but every window works if i run them one by one.

Windows 10 x64
Cmdow 1.4.8

Cygwin/Mingw compiling instructions

Could you please include instructions how to compile it under cygwin / mingw? I've just managed to compile it under cygwin + mingw x64 and it works fine. Someone may not be allowed to download .exe binaries but may be able to compile them. Steps to build:

  1. Install mingw64-x86_64-gcc-core ang mingw64-x86_64-gcc-g++ packages using setup_x86_64.exe cygwin installer.

  2. Download cmdow sources and cd into cmdow directory. Then run:

$ x86_64-w64-mingw32-g++ -static -fpermissive *cpp -o cmdow
[... gives you some warnings but compiles ok...]
$ x86_64-w64-mingw32-strip.exe cmdow.exe
$ ./cmdow.exe /?
CMDOW [Version 1.4.8] Win32 Commandline Window Utility for NT4/2000/XP/7.
(C) Copyright 2001-2014 Ritchie Lawrence, http://www.commandline.co.uk.

  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]
        [/REN caption] [/TOP] [/NOT] [/MOV left top] [/SIZ width height] [/CLS]
        [/END]}
  CMDOW /RUN [state] file [args]
[... rest of output skipped ...]

error in /run /hid

hi
when use in command /run /hid program.exe not worked and error Error: Unable to execute/open specified file.

please help...

thanx

Malware Related Request

Hello Richie.

I like cmdow and am going to integrate it in my tool. To be save not to scare any customer i would like to avoid any problem with an anti-virus vendor. Due to the fact, that i do not need the hide window feature, can you remove it in a simple way such that no problem with any vendor will occure?
I experienced this problem myself, when i first downloaded the binary: Before i recognized what happend, the virus scanner removed the binary.

Best regards

Handle of window open with CMOD /RUN /HID

If I open to instances of exec.exe using CMOD /RUN /HID each one will have a different handle but probably same window name, so, it is not possible to know which handle belongs to which one.

Is CMOD returning after execution of CMOD /RUN /HID any variable that contains handle of created windows?

Thks

Move a window to a different monitor

I'm looking to create a shortcut that moves a specific window to a second monitor and maximizes it (and ideally moves any other window on that monitor to the first monitor), but I'm not seeing anything in the directions about specifying monitors.

Cannot MOV the Task Manager window

I am able to move every visible window except the Task Manager (taskmgr).

I am able to /ACT it, confirming that I have correct handle. However, no amount of /MOV will move it.

Is there something special about the Task Manager application?

PS: Thanks for the great piece of work. I find this very handy to reposition all my >30 applications on my Extended Desktop whenever my 4K display is powered up a bit behind my laptop coming out of hibernation and all the windows fall into my laptop's display. I make a snap shot of all the windows coordinates regularly, and have another script to reposition from the saved snapshot.

Selecting a Window Based on Image

Is the above possible? If I have two windows open both named "CRAZY WINDOW NAME" one being a program/executable and another being "explorer", is it possible to just target the explorer window and leave the program/executable alone?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.