Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement graphical Interface in batch bat

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you batch processing bat how to achieve the graphical interface, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!

First, pop-up windows

1. Msg command

Msg username% "Hello!"

2. Mshta program

(1) using the msgbox function of vbsript

Mshta _ vbscript:msgbox ("Hello!" , 64, "window") (window.close)

(2) using the popup method of vbscript

Mshta _ vbscript:CreateObject ("Wscript.Shell") .popup ("Hello", 7, "window", 64) (window.close)

(3) using the alert method of javascript

Mshta _ javascript:window.alert ("Hello"); window.close ()

(4) using the popup method of javascript

Mshta "_ javascript:new ActiveXObject ('WScript.Shell'). Popup (' Hellograph', 7 'window', 64); window.close ();

(5) confirm method of javascript

Mshta _ javascript:confirm ("ha"); window.close ()

(6) execScript method of javascript-alert

Mshta _ vbscript:window.execScript ("alert ('hello worldview');", "javascript")

(7) execScript method of javascript-msgBox

Mshta _ javascript:window.execScript ("msgBox ('hello worldview'): window.close", "vbs")

(8) execute method of javascript

Mshta _ vbscript:execute ("msgbox"one BOX": msgbox"two BOX": window.close")

Second, play sound

1. Mshta program

Mshta _ vbscript:createobject ("sapi.spvoice"). Speak ("I am human!") (window.close)

Third, a few points to pay attention to

1. Ping-n 1 127.1 > nul

(1) ping is a network command to test network connectivity. The parameter "- n 1" means that ICMPS packets are sent only once to test network connectivity.

(2) 127.1 means that the machine retains the IP address. Actually, 127.1 means ping 127.0.0.1, which can be used to test whether the network card and TCP/IP protocol are installed and working properly.

(3) "> nul" means to redirect the on-screen display information generated by the command to an empty device (nul), so that the execution result of the ping command is not displayed on the screen. > nul is to mask the display of standard output on the screen, 2 > nul is to screen error display, and "> nul 2 > nul" is to block the screen display whether it is right or wrong.

It is generally used for delay in batch processing. This is not a timing command at all. It is impossible to "display timing". It just takes about 1 second to run this command. It can be simplified as ping-n 2 127.1 > nul, and two 0 commands will be added automatically when running. > nul does not display the result information of ping command execution. The number of packets sent is defined after / n. It takes about 1 second to send 2 packets, but this time is not accurate. 127.0.0.1 is a native ip, regardless of whether it is connected or not, the ip exists as long as there is a network card on the computer. This ping command is often used to test whether the network card is intact.

2. Control

(1) pause batch processing: press the Pause key on the keyboard directly

(2) terminate batch processing: key combination Ctrl+C. But sometimes it doesn't seem to respond very positively.

IV. User interaction

1. Color command: set the background color and font color of the window, using color/? View

2. Mode command: set the window size "MODE CON [COLS=c] [LINES=n]", cols is the width and lines is the height.

3. Msg command: GUI interaction window. For more information, please see msg /?

These are all the contents of the article "how to implement a graphical interface in batch bat". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report