Mos*_*oss 13 windows window task-scheduler
有没有一种很好的方法可以让消息框在其他窗口的预定时间弹出?默认的“显示消息”操作无用地出现在其他所有内容下方。
JSa*_*hez 13
msg像这样使用Window的内置命令怎么样?
msg * "Message you would like to send"
您可以添加其他参数,例如/TIME:x其中 x 是您希望消息显示的秒数。当然,msg /?会向您展示所有可用的选项。
这意味着要在其中显示消息的系统是 Windows XP 及更高版本。如果您有适用操作系统的家庭版,那么您就不走运了。有关可用参数,请参阅http://ss64.com/nt/msg.html。
如果您有家庭版,以下批处理脚本将使用 VBSCript 的 PopUp 方法弹出一条消息:
@echo off
::See http://msdn.microsoft.com/en-us/library/x83z1d9f(v=vs.84).aspx
::for an explanation of the PopUp method
::
::Use the directory from whence script was called as working directory
set CWD=%~dp0
::Use a random file name for the temporary VBScript.
set usrmsg=%CWD%%random%.vbs
::First parameter is the timeout in seconds. 0 = wait forever
set _timeout=%~1
::Second parameter is the message, enclosed in quotes.
set _Message=%~2
::Third parameter is the title of the window, enclosed in quotes.
set _Title=%~3
::This last variable is used to display a button/icon on the window.
::Setting this to 4096 sets the window to Modal (on top of everything else)
set _nType=4160
::Create the temp script using the provided information.
ECHO Set wshShell = CreateObject( "WScript.Shell" )>%usrmsg%
ECHO wshShell.Popup "%_Message%" ^& vbCrLf, %_Timeout%, "%_Title%", %_nType%>>%usrmsg%
::Run the script.
WSCRIPT.EXE %usrmsg%
::Delete the script.
DEL %usrmsg%
::Exit the batch file
exit /b
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助!
补充:Gregg 在评论中提到,为了使其在 Windows 10 中工作,如果您希望消息在屏幕上停留超过 60 秒,则必须使用“/time:0”。
小智 6
另请参阅https://www.howtogeek.com/136894/how-to-create-popup-reminders-with-no-additional-software/。在链接死亡的情况下,我将在这里总结:
/C TITLE [您的标题] &ECHO.&ECHO.&ECHO [您的留言] &ECHO.&ECHO.&TIMEOUT [超时]
这将生成一个带有给定文本的控制台窗口,该窗口将显示在当前窗口的顶部,但不会自动窃取焦点(您可以像往常一样继续与当前窗口交互)。
这是我找到的最好的解决方案,希望它可以帮助某人!
| 归档时间: |
|
| 查看次数: |
23845 次 |
| 最近记录: |