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
How to Enable the Group Policy Editor in Windows 11 HomeHow to Enable the Group Policy Editor in Windows 11 HomeApr 15, 2025 pm 06:01 PM

Enable the Group Policy Editor (gpedit.msc) on Windows 11 Home: A Step-by-Step Guide Many users, especially in shared office environments, rely on the Group Policy Editor (gpedit.msc) for managing multiple user accounts and preventing unauthorized ac

Windows kb5054979 update information Update content listWindows kb5054979 update information Update content listApr 15, 2025 pm 05:36 PM

KB5054979 is a cumulative security update released on March 27, 2025, for Windows 11 version 24H2. It targets .NET Framework versions 3.5 and 4.8.1, enhancing security and overall stability. Notably, the update addresses an issue with file and directory operations on UNC shares using System.IO APIs. Two installation methods are provided: one through Windows Settings by checking for updates under Windows Update, and the other via a manual download from the Microsoft Update Catalog.

Creating an Encrypted Backup Drive That Works on Windows, Mac, and LinuxCreating an Encrypted Backup Drive That Works on Windows, Mac, and LinuxApr 15, 2025 am 06:13 AM

Protecting Your Digital Life: Creating Encrypted Backups with VeraCrypt Our digital lives are brimming with irreplaceable memories, crucial documents, and essential work files. The loss of these due to device failure, theft, or ransomware attacks co

How (and Why) to Turn Off Mouse Acceleration on Windows 11How (and Why) to Turn Off Mouse Acceleration on Windows 11Apr 15, 2025 am 06:06 AM

Improve mouse accuracy: Disable Windows 11 mouse acceleration function The mouse cursor moves too fast on the screen, even if you only move the mouse a few centimeters? This is what the mouse acceleration function is. This article will guide you on how to disable this feature to better control mouse movement. Is it wise to disable mouse acceleration? There is no direct "Mouse Acceleration" option in Windows systems. Instead, it is the "Enhanced Pointer Precision" setting, which Microsoft sees as a mouse acceleration feature. When this feature is enabled, the mouse's DPI (dots per inch) setting takes effect. It controls the relationship between the physical movement speed of the mouse and the distance the cursor moves on the screen. Move the mouse slowly, Windows will reduce the effective DPI and the cursor moves shorter

GPD Duo Laptop Review: Dual-Screen Productivity For Experienced UsersGPD Duo Laptop Review: Dual-Screen Productivity For Experienced UsersApr 15, 2025 am 06:05 AM

The GPD Duo: A Powerful Dual-Screen Laptop Hampered by Software Issues Mobile productivity gets a boost with the GPD Duo's innovative dual-screen design. However, significant software shortcomings prevent it from reaching its full potential. Rating

Razer's Remote Play May Be Better Than Steam LinkRazer's Remote Play May Be Better Than Steam LinkApr 15, 2025 am 06:04 AM

Razer's new remote play app offers a compelling alternative to established services like Steam Link. Integrating seamlessly with Razer Cortex, the app allows users to launch PC games with a single tap. Android users benefit from haptic feedback whe

10 Ways to Customize the Windows 11 Start Menu10 Ways to Customize the Windows 11 Start MenuApr 15, 2025 am 06:02 AM

Customize Your Windows 11 Start Menu: A Comprehensive Guide The Windows 11 Start Menu is your gateway to apps and settings. If the default setup isn't to your liking, personalization options let you tailor it to your needs. This guide explores vari

How to Use Windows 11 as a Bluetooth Audio ReceiverHow to Use Windows 11 as a Bluetooth Audio ReceiverApr 15, 2025 am 03:01 AM

Turn your Windows 11 PC into a Bluetooth speaker and enjoy your favorite music from your phone! This guide shows you how to easily connect your iPhone or Android device to your computer for audio playback. Step 1: Pair Your Bluetooth Device First, pa

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor