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 hide the cmd command line runtime box with WScript.Shell object

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Editor to share with you how to use the WScript.Shell object to hide the cmd command line runtime box, I believe 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 know it!

1. WScript.Shell (Windows Script Host Runtime Library) is an object, and the corresponding file is C:\ WINDOWS\ system32\ wshom.ocx,Wscript.shell, which is a component used by the server system. Shell means "shell". This object can perform operations commonly used by operating system shells, such as running programs, reading and writing registries, environment variables, and so on. This object is usually used in VB or VBS programming.

two。 Install the WScript.Shell object: regsvr32 WShom.Ocx

Uninstall the WScript.Shell object: regsvr32-u WShom.Ocx or regsvr32 / u WShom.Ocx

3. For example, suppose the mytest*.iso files are all in the C: root directory. Establish the mytest directory and copy the mytest*.iso file to the mytest directory.

Create the testcopy.bat file and store it in the C: root directory.

The code is as follows:

Md mytest

Copy c:\ mytest*.iso mytest

Pause

Double-click testcopy.dat to see the newly created mytest directory and the copied mytest*.iso file.

There are two ways to hide the cmd command line window.

(1) create a WScript.Shell object, which runs the testcopy.dat file directly, and the corresponding vbs file: testcopy1.vbs. Double-click testcopy1.vbs to see the effect.

The code is as follows:

Dim objShell

Set objShell=wscript.createObject ("WScript.Shell")

IReturnCode=objShell.Run ("c:\ testcopy.bat", 0jol true)

(2) create a WScript.Shell object, which directly runs the dos command and the command in testcopy.dat, and the corresponding vbs file: testcopy2.vbs

The code is as follows:

Dim objShell

Set objShell=wscript.createObject ("WScript.Shell")

IReturnCode=objShell.Run ("cmd.exe / cmd mytest", 0jol true)

IReturnCode=objShell.Run ("cmd.exe / c copy c:\ mytest*.iso mytest", 0jol true)

The above is all the content of the article "how to use WScript.Shell objects to hide cmd command line runtime boxes". 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