3

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!

daniel11
  • 2,027
  • 10
  • 38
  • 46

3 Answers3

3

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.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • O im sorry, but i didnt understand a thing you just said, and i am well aware that there are more effective methods of doing this however i was just wondering if it was possible.... but i guess not.. – daniel11 Dec 12 '10 at 04:30
  • @daniel11: I mean if one tool not do what you need you can write another one calling mostly only two functions `WTSSendMessage` and `WTSEnumerateSessions`. I suppose you can do this also from python (see http://stackoverflow.com/questions/252417/how-can-i-use-a-dll-from-python for example) – Oleg Dec 12 '10 at 09:13
3

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).

Dalmas
  • 26,409
  • 9
  • 67
  • 80
0

the msg * text doesn't work in windows ten.I made a program to help though

@ECHO Off
echo -downloading paused-
echo MsgBox "are you sure you want to download 'msgBox extension' by Ronan? Oh wait ,sigh,I forgot to add the yes or no part...ok,hit ok for yes,or hit the X on the cmd terminal for no." > msg.vbs
msg.vbs
cls
del msg.vbs
echo alrighty then!
pause >nul
cls
@ECHO On
mkdir "msgBox extension"
echo start /min cache\messageB ^& exit > "msgBox extension\messageBox.bat"
echo blank..? > "msgBox extension\text.txt"
mkdir "msgBox extension\cache"
>"msgBox extension\cache\messageB.bat" (
echo set /p var=^< text.txt
echo echo MsgBox " %%var%% " ^> msgbox.vbs
echo msgbox.vbs
echo del msgbox.vbs
echo exit
)
pause
@Echo Off
cls
echo ok,good.you downloaded the software.just for good measure,do a scan of your computer,find viruses, THEN DELETE THE FOLDER ASAP. it means someone stole this program and added viruses to it.ooorrrrrrrr it's something else.
pause >nul
cls
echo now I will tell you how to use the software
echo in a batch file,or cmd prompt,: "msgBox extension\text.txt" will input text into the software. which will be used in : "msgBox extension\messageBox.bat" will display a text box of the imputed text.
echo good luck!
pause >nul

to use it though,in cmd or batch files,echo text here > "msgBox extension\text.txt" is the input,and "msgBox extension\messageBox.bat" will activate it via text box.