Sorry to poo-poo the advice above that says
a, its ONLY on Professional, Enterprise and Ultimate - ITS NOT! Its on HOME Premium as well.
b, You need a third party product only to run it - NOT TRUE. I will demonstrate below.
c, You need Powershell - NO.
I have it working perfectly without any of the above.
I am using Home Premium, and have a bat script that under XP said
NET SENT %username% Y: DRIVE NOT CONNECTED!
So, moving to Win7, I needed to replace this command with an equivalent. Rather than follow various google posts that says a REGISTRY mod is required to enable to run (and only at an elevated prompt), or give up because apparently its not available at all
(being Home edition), I simply searched for the msg.exe in the system, found its location and added the path. There are 3 options:
OPTION A: Add the path prior to calling the new msg command. So now the new line(s) are
path=%path%;C:\Windows\winsxs\amd64_microsoft-windows-t..commandlinetoolsmqq_31bf3856ad364e35_6.1.7600.16385_none_851e6308c5b62529
msg %Username% Y: DRIVE NOT CONNECTED!
OPTION B: state the calling path of the executable (single line):
C:\Windows\winsxs\amd64_microsoft-windows-t..commandlinetoolsmqq_31bf3856ad364e35_6.1.7600.16385_none_851e6308c5b62529\msg %Username% Y: DRIVE NOT CONNECTED!
OPTION C: (my preferred): add the path to the system environment variables (explained below), and then the new script command will simply be:
msg %Username% Y: DRIVE NOT CONNECTED!
Job done! No registry change.. No elevated privileges. No powershell or script required. No giving up.
So, to summarise:
Simply add the path to the command either:
a, by terms of a previous path addition (when running a script) as above
b, include the path into the command to point to it (when running a script) (ie, [path]\msg.exe [user] text)
c, add the path above to the ENVIRONMENT VARIABLES so they are there always for when you want to run an impromptu msg at command prompt:
right click 'COMPUTER' - Properties -Advanced System Settings - Advanced - Environment Variables - add the above location to the end of the SYSTEM 'PATH' variable (following a semicolon)
The beauty of this for me who dont like changing my system with registry etc as I dont know what hidden perils it may cause, is that .....it doesnt change my system and therefore I stay safe from hidden perils! :-)