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

The usage of GetDrive method in VBS

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains the usage of GetDrive method in VBS. Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's take you to learn the usage of GetDrive method in VBS!

Returns the Drive object corresponding to the drive in the specified path.

object.GetDrive drivespec

Parameter object

Required. Expected name of FileSystemObject.

drivespec

Required. Drivespec can be a drive letter (c), a drive letter with a colon (c:), a drive letter with a colon and path separator (c:\), or any specified network share (\\computer2\share1).

description

For a network share, check to make sure that the network share exists.

If drivespec is inconsistent with or does not exist in an accepted format, an error occurs. To use the standard path string when calling the GetDrive method, use the following sequence to get the string matching drivespec:

DriveSpec = GetDriveName(GetAbsolutePathName(Path))

The following example illustrates how to use the GetDrive method:

Function ShowFreeSpace(drvPath) Dim fso, d, s Set fso = CreateObject("Scripting.FileSystemObject") Set d = fso.GetDrive(fso.GetDriveName(drvPath)) s = "Drive " & UCase(drvPath) & " - " s = s & d.VolumeName & "

" s = s & "Free Space: " & FormatNumber(d.FreeSpace/1024, 0) s = s & " Kbytes" ShowFreeSpace = sEnd Function At this point, I believe everyone has a deeper understanding of "the usage of GetDrive method in VBS", so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

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