Advanced uses of the msg * command in a batch file?

37,162

Solution 1

First of all I don't know some additional undocumented switches of msg.exe which you can use to create the message in the form which you want. Because you asked about any information or ideas I decide do to write my answer.

How you can see with respect of Dependency Walker the program msg.exe use internally functions WinStationSendMessageW, WinStationEnumerateW, WinStationQueryInformationW, WinStationOpenServerW, WinStationFreeMemory from the winsta.dll . The function WinStationQueryInformationW is documented, all other functions not. Nevertheless one can be relatively sure that the functions are identical to the documented function RpcWinStationSendMessage and other RpcWinStationXXX functions documented in Terminal Services Terminal Server Runtime Interface. I personally see no need to use the undocumented functions because other documented functions WTSSendMessage, WTSEnumerateSessions (see Remote Desktop Services API) can do the same.

Both functions WTSSendMessage and RpcWinStationSendMessage have parameters pTitle, Style (which can be MB_YESNOCANCEL for example), and pResponse (which can be also interesting you you). So I suggest that you or one from your colleges just write the small utility yourself which you need. You can use documented WTSSendMessage and WTSEnumerateSessions functions in the implementation.

If you'll ask a question of the serverfault.com or superuser.com probably somebody will recommend you an existing utility which you can use.

Solution 2

Sorry but it's not possible to change the popup showed by the batch "msg" command.

What Oleg said is that if you want to create a custom popup, you can't do it with the windows "msg" command. There is no other way than creating your own "msg" command, which opens a custom popup (and there are many ways to do this, explained by Oleg).

Share:
37,162
daniel11
Author by

daniel11

Updated on September 02, 2020

Comments

  • daniel11
    daniel11 over 3 years

    EDIT: I have started a bounty of 50 on this question to who ever gives the best answer!

    Hi i was wondering if there was a way for a batch file to make a pop up appear using the msg * "hi" command along with other selections besides the ones that are there by default (cancel and ok) by this, i mean add custom buttons to the pop up message such as a "next" button that would bring you to another pop up message with dialog on it or something along those lines. In summary , is there a way to edit the results of the msg * "text goes here" command?

    This is what comes up...

    alt text

    And this is kind of what i want:

    alt text

    However , i also would like to know if its possible to change the title of the pop up message and the size or position of it. I know that this is starting to sound like a gui based popup in a batch file but im just wondering if its possible by any means neccessary (Keep in mind that i only want to use batch/shell). Any information or ideas would really help! Thanks!