I have got a .bat file to run in my shool that warns users that any damage made to the devices will be punished unless reported. I want the text in this msg box to be bigger and a different color/font. how cane I do that? my msg command looks like this: msg * /time:30 <text here>
thanks in advance for any answers.
Asked
Active
Viewed 3,478 times
1

laundmo
- 318
- 5
- 16
2 Answers
3
You can create try with batch/mshta polyglot script.Here's an example.Save this with bat extension:
<!-- :
@echo off
start "" mshta.exe "%~f0"
exit /b
-->
<html>
<head><title>HTA window</title></head>
<body bgcolor="green"><h1><font size="3" color="red face="verdana">message</h1></font ></body>
<button onclick="myFunction()">OK</button>
<script>
function myFunction() {
window.close();
}
</script>
</html>
you can customize the layout as you want.To run this in different session you'll have to use runas command - https://superuser.com/questions/42537/is-there-any-sudo-command-for-windows

npocmaka
- 55,367
- 18
- 148
- 187
-
That's a slick trick - it's not supposed to work (that first HTML comment line is a batch input redirection, and should complain about a missing file), but it does indeed work. What it doesn't do that the user's original `msg` command does is wait for a timeout and then proceed. Is there a way to do that in a `.hta`? – Jeff Zeitlin May 09 '17 at 14:41
-
@JeffZeitlin - because redirection is an operation with higher priority and because of batch parser it will try to use `:` as an input file and the first line will be interpreted as `: – npocmaka May 09 '17 at 18:09
-
Understood - but your description clearly makes it a bug in the parser - it shouldn't be taking it as a comment/label; it should be complaining about a missing file `!--`. When I try it here, I get, variously, success, "The syntax of the command is incorrect", and "The system cannot find the file specified". – Jeff Zeitlin May 09 '17 at 18:26
-
@JeffZeitlin - it does not work in command prompt.Only in batch file. – npocmaka May 09 '17 at 18:32
-
Matches my experience - except that I also got the error, depending on the next command, in the batch file - if @echo off, success, if blank line, syntax incorrect, if echo off with no @, cannot find file. As I said, bug in CMD.EXE parser. – Jeff Zeitlin May 09 '17 at 18:57
-
A quite useful bug that many have exploited to achieve the desired result. – lit May 09 '17 at 22:29
-1
There are no provisions to do this with the MSG command. You will have to do this with your own program.

Jeff Zeitlin
- 9,773
- 2
- 21
- 33