search
HomeSystem TutorialWindows SeriesVBS application in Windows 11: How to close the program?

VBS application in Windows 11: How to close the program?

Mar 09, 2024 am 09:30 AM
windowsturn off an appvbs programming

In Windows 11, VBS (Visual Basic Script) is a powerful scripting language that can be used to automate tasks and handle various operations. When using Windows 11 on a daily basis, sometimes we may need to close some running programs, and VBS scripts provide a quick and convenient way to achieve this purpose. Next, we will introduce how to use VBS to close programs in Windows 11.

First, open a text editor, such as Notepad, and enter the following code in the text editor:

Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
' 这里输入要关闭的程序的进程名称,比如关闭记事本程序
WshShell.Run "taskkill /F /IM notepad.exe", 0, True
Set WshShell = Nothing

In the above code, we used WScript.ShellObject creates a Shell object, and then uses the taskkill command to close the program with the specified process name, where the /F parameter indicates forced shutdown, and the /IM parameter is followed by The process name of the program to be shut down. In the example in the code, we closed the Notepad program (notepad.exe). You can also change it to the process name of other programs as needed.

Next, save the above code as a .vbs file, such as close_program.vbs. When saving, remember to select "Save Type" as "All Files" and add the .vbs suffix to the file name.

After saving, double-click to run the .vbs file to close the specified program. If everything goes well, the program will be closed smoothly.

In general, VBS is widely used in Windows 11, and many automated tasks can be realized through scripts. Closing a program is just one of the application scenarios. You can also write different VBS scripts to achieve other functions, such as automated file operations, network configuration, etc.

When using VBS scripts, please be sure to pay attention to the impact on the system and programs, make sure you know the functions and operations of the scripts, and avoid unnecessary losses. I hope the above content is helpful to you, and I wish you a happy use of VBS scripts in Windows 11!

The above is the detailed content of VBS application in Windows 11: How to close the program?. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
The New Surface Pro Doesn't Feel ProThe New Surface Pro Doesn't Feel ProMay 08, 2025 am 06:01 AM

The new Surface Pro: A step back? Microsoft's latest Surface Pro offers connectivity via two USB-C ports, supporting charging, USB 3.2 data transfer, and DisplayPort 1.4a (up to two 4K monitors at 60Hz). However, the device ships without a power ad

Microsoft Challenges the MacBook Air With New Surface LaptopMicrosoft Challenges the MacBook Air With New Surface LaptopMay 08, 2025 am 03:02 AM

Microsoft's latest Surface Laptop aims to rival the MacBook Air, but with some notable compromises. The absence of a Surface Connect port marks a significant departure from previous models, reflecting the growing prevalence of Thunderbolt and USB do

Solve the problem that the svn plugin in eclipse always prompts for password inputSolve the problem that the svn plugin in eclipse always prompts for password inputMay 07, 2025 pm 05:03 PM

1. Background Recently, when using the svn plug-in to manage remote warehouse code in eclipse, prompts to enter passwords are always prompted to enter passwords, which is particularly annoying. After hard work, I finally solved the problem and shared it with you~ 2. Analysis of the password mechanism of the svn plug-in and the cause of the problem. When we use the svn plug-in for the first time and enter the password, a file that saves the password will be generated, and then the svn plug-in will read the username and password information by default every time. When eclipse is started, the configuration information will be automatically read into the program cache. After the password of svn is modified, it is impossible to log in again, and there is no prompt to re-enter the password. At this time, we can delete the relevant configuration files and let the svn plugin prompt us to re-enter the password. However, ec

How to restore the win8 system details stepsHow to restore the win8 system details stepsMay 07, 2025 pm 05:00 PM

The steps to start system restore in Windows 8 are: 1. Press the Windows key X to open the shortcut menu; 2. Select "Control Panel", enter "System and Security", and click "System"; 3. Select "System Protection", and click "System Restore"; 4. Enter the administrator password and select the restore point. When selecting the appropriate restore point, it is recommended to select the restore point before the problem occurs, or remember a specific date when the system is running well. During the system restore process, if you encounter "The system restore cannot be completed", you can try another restore point or use the "sfc/scannow" command to repair the system files. After restoring, you need to check the system operation status, reinstall or configure the software, and re-back up the data, and create new restore points regularly.

'Modern Operating System Original Book 3rd Edition''Modern Operating System Original Book 3rd Edition'May 07, 2025 pm 04:57 PM

"Modern Operating Systems (English Edition 3rd Edition)" is a classic work written by Professor Tanenbaum. With his profound experience in the design of three operating systems, the book perfectly integrates theory and practice. The third edition of the book explores a number of topics in depth, such as process, threading, storage management, file systems, I/O deadlock, interface design, multimedia, performance trade-offs, and introduces the latest trends in operating system design. The book not only explains the principles and practices of modern operating systems in detail, but also pays special attention to Linux operating systems, Windows Vista operating systems, embedded operating systems, real-time operating systems and multimedia operating systems. Covering Windows Vista and the latest Linux/Unix operations

.NET Core Quick Start Tutorial 1. The beginning: Talking about .NET Core.NET Core Quick Start Tutorial 1. The beginning: Talking about .NET CoreMay 07, 2025 pm 04:54 PM

1. The Origin of .NETCore When talking about .NETCore, we must not mention its predecessor .NET. Java was in the limelight at that time, and Microsoft also favored Java. The Java virtual machine on the Windows platform was developed by Microsoft based on JVM standards. It is said to be the best performance Java virtual machine at that time. However, Microsoft has its own little abacus, trying to bundle Java with the Windows platform and add some Windows-specific features. Sun's dissatisfaction with this led to a breakdown of the relationship between the two parties, and Microsoft then launched .NET. .NET has borrowed many features of Java since its inception and gradually surpassed Java in language features and form development. Java in version 1.6

Solve the problem that the 80 port under Windows 10 is occupied by the System with PID 4Solve the problem that the 80 port under Windows 10 is occupied by the System with PID 4May 07, 2025 pm 04:51 PM

1. Background Recently, out of curiosity, I updated the Windows 10 system, which is very easy to operate and the experience is quite good. However, when developing in IDEA, when starting the project using port 80, it is found that the port has been occupied. After some attempts, I found a solution and I will share it with you. 2. Solution steps 1. Check the process number PID that occupies port 80 by executing the netstat-ano|findstr "80" command. 2. Since port 80 is occupied by system services, the process cannot be terminated directly. Therefore, use the netshhttpshowservicestate command to view the current HTTP service status. The result is as shown in the figure: from the figure

10 latest tools for web developers10 latest tools for web developersMay 07, 2025 pm 04:48 PM

Web development design is a promising career field. However, this industry also faces many challenges. As more businesses and brands turn to the online marketplace, web developers have the opportunity to demonstrate their skills and succeed in their careers. However, as demand for web development continues to grow, the number of developers is also increasing, resulting in increasingly fierce competition. But it’s exciting that if you have the talent and will, you can always find new ways to create unique designs and ideas. As a web developer, you may need to keep looking for new tools and resources. These new tools and resources not only make your job more convenient, but also improve the quality of your work, thus helping you win more business and customers. The trends of web development are constantly changing.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.