Change the Command window title of a running script

Source: Internet
Author: User

You can simply use the following statement to implement the caption of the window

Setobjshell = CreateObject ("Wscript.Shell")

Objshell.run ("%comspec%/k title My Command Window |ping.exe 192.168.1.1"), 1, TRUE

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/76/3F/wKioL1ZN1xbiiPbBAACecz2OVh8396.png "title=" 1.png " alt= "Wkiol1zn1xbiipbbaacecz2ovh8396.png"/>

we've created a new Wscript.Shell Object Instance (instance), then we run the Ping.exe using the run behavior and use the %comspec% A new command window is launched, using the/k switch to ensure that the window remains open after the script finishes, and that the window's Title is "My commandwindows", which makes theinterface more straightforward.

we have used | symbol to ensure that it runs simultaneously Ping command. It's the equivalent of a directive: "Open a command window, set the window header, and run Ping.exe." If there is no pipe symbol, the script opens a new Title for the "My commandwindows" command-line window, closes and then opens another window to run Ping.exe.

You can try the following code

Setobjshell = CreateObject ("Wscript.Shell")

Objshell.run ("%comspec%/k title My Command Window"), 1, TRUE

Objshell.run ("ping.exe10.0.1.1"), 1, TRUE

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/76/3F/wKioL1ZN1yWS7gsvAABOUw75SVw304.png "title=" 2.png " alt= "Wkiol1zn1yws7gsvaabouw75svw304.png"/>

You can see that the header has not been modified.

Of course, if you want to modify the color of the front and back interface, try the following code

Setobjshell = CreateObject ("Wscript.Shell")

Objshell.run ("%comspec%/t:2e/k title My Command window|ping.exe" & "10.0.1.1"), 1, TRUE

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/76/3F/wKioL1ZN1zzQvVX7AACAamRy2X4151.png "title=" 3.png " alt= "Wkiol1zn1zzqvvx7aacaamry2x4151.png"/>

we are implemented by the/T switch,2 for Green,E for yellow, the specific color code is as follows :

0 =black

1 =blue

2 =green

3 =aqua

4 =red

5 =purple

6 =yellow

7 =white

8 =gray

9 =light Blue

A =light Green

B =light Aqua

C =light Red

D =light Purple

E =light Yellow

F =bright White

Welcome to scan or search for my "Windows Automation Operations" public number, and I will regularly publish the knowledge of Windows Automation operations on a daily basis for you to discuss.

650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M02/76/3F/wKioL1ZN1_ry0DBDAABsCkHlBCM565.jpg "title=" QRCode _for_gh_394ccb413d36_258.jpg "alt=" Wkiol1zn1_ry0dbdaabsckhlbcm565.jpg "/>

I: Bjyizhang, add friend Please specify "script discussion"


This article is from the "Johnny" blog, make sure to keep this source http://bjyizhang.blog.51cto.com/113024/1714839

Change the Command window title of a running script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.