Get the App
SLTechnology News&Howtos  ›  Development  › 

How does vbs implement the script in which the drive letter is double-clicked?

Shulou Source: shulou.com Published: 2022-06-03 06:24:01 11月17日 Update

This article mainly shows you the "vbs how to achieve the interpretation of the drive letter is double-clicked script", the content is easy to understand, well-organized, hope to help you solve your doubts, the following let the editor lead you to study and learn "vbs how to interpret the drive letter is double-clicked script" this article.

The copy code is as follows:

Do while true

Set WshShell = WScript.CreateObject ("WScript.Shell")

IF WshShell.AppActivate ("D:\") Then

MsgBox "ok"

Wscript.quit

End If

Loop

You don't even have to try to know that this code is wrong. Because WshShell.AppActivate considers the characters or strings contained in the Caption of the form, you use WshShell.AppActivate ("D:\"), which means that the string "D:\" should be included in the form Caption. But you open the D disk to have a look, is that so? They are all "local disks (D:)". If there is a volume label, it is even more uncertain. So it should be written as WshShell.AppActivate ("(D:)"). Considering the memory savings, it should be written like this:

Set WshShell = WScript.CreateObject ("WScript.Shell")

Do

IF WshShell.AppActivate ((D:)) Then

MsgBox "ok"

Wscript.quit

End If

Loop

The above is all the contents of the article "how to read the script in which the drive letter is double-clicked by vbs". 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!

Tags: Scripts code content characters articles strings forms learning help memory that is easy to understand more organization knowledge disk tape industry information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Docker vpn macOS MariaDB